Why am I getting this error when using np.dot(a,b.T)
:
TypeError: Cannot cast array data from dtype('float64')
to dtype('S32') according to the rule 'safe'
a and b are of type numpy.ndarray
. My NumPy
version is 1.11.0.
Why am I getting this error when using np.dot(a,b.T)
:
TypeError: Cannot cast array data from dtype('float64')
to dtype('S32') according to the rule 'safe'
a and b are of type numpy.ndarray
. My NumPy
version is 1.11.0.
Try converting whole numpy array into float Example:
Just taking the input from BrenBarn and Warren Weckesser to provide a code snippet which should run (by converting your strings to float):
or simpler as suggested by @JLT
But as Warren Weckesser already said, you should check the types of the array, most likely one already contains floats.