TypeError: cannot perform reduce with flexible type
In python, if you meet this error, it means:
You wrote numbers in the form of strings, and you use methods for numbers to deal with these strings.
I create an “numeric” array in the form of strings:
array = np.array([['1', '2', '3'], ['4', '5', '6']])
then, I try to obtain the average of this array:
>>> np.average(array) ... TypeError: cannot perform reduce with flexible type.
I get this error.
Just transfer your strings to numbers.