title: Numpy std calculation: TypeError: cannot perform reduce with flexible type
body: <p>I am trying to read lines of numbers starting at line 7 and compiling the numbers into a list until there is no more data, then calculate standard deviation and %rms on this list. Seems straightforward but I keep getting the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "rmscalc.py", line 21, in &lt;module&gt;
      std = np.std(values)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/fromnumeric.py", line 2817, in std
      keepdims=keepdims)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/_methods.py", line 116, in _std
      keepdims=keepdims)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/_methods.py", line 86, in _var
      arrmean = um.add.reduce(arr, axis=axis, dtype=dtype, keepdims=True)
  TypeError: cannot perform reduce with flexible type
  </code></pre>
  
  <p>Here is my code below: </p>
  
  <pre><code>import numpy as np
  import glob
  import os
  
  values = []
  line_number = 6
  
  road = '/Users/allisondavis/Documents/HCl'
  for pbpfile in glob.glob(os.path.join(road, 'pbpfile*')): 
      lines = open(pbpfile, 'r').readlines()
      while line_number &lt; 400 :
          if lines[line_number] == '\n':
              break
          else: 
              variables = lines[line_number].split()
              values.append(variables)
              line_number = line_number + 3
              print values
  
  a = np.asarray(values).astype(np.float32)
  std = np.std(a)
  rms = std * 100
  print rms
  </code></pre>
  
  <p>Edit: It produces an rms (which is wrong - not sure why yet) but the following error message is confusing: I need the count to be high (picked 400 just to ensure it would get the entire file no matter how large)</p>
  
  <pre><code> Traceback (most recent call last):
    File "rmscalc.py", line 13, in &lt;module&gt;
      if lines[line_number] == '\n':
  IndexError: list index out of range
  </code></pre>