Numpy std calculation: TypeError: cannot perform reduce with flexible type

values is a string array and so is a. Convert a into a numeric type using astype. For example,

a = np.asarray(values).astype(np.float32)
std = np.std(a) 

Leave a Comment