>>> import numpy as np
>>> a = np.array([1,2,3])
>>> b = 2.0
>>> a /= b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ufunc 'true_divide' output (typecode 'd') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''
When I create array filled with floats - it works:
>>> a = np.array([1.0, 2.0, 3.0])
>>> a /= 2.0
>>> a
array([ 0.5, 1. , 1.5])
We should provide some casting to floats or at least better feedback for the user. I googled this issue for a while to understand what it means.
Example code which uses it can be found in beprof.profile.Profile.normalize().
For array filled with integers only:
When I create array filled with floats - it works:
We should provide some casting to floats or at least better feedback for the user. I googled this issue for a while to understand what it means.
Example code which uses it can be found in
beprof.profile.Profile.normalize()
.