My task is count histogram for different arrays of numbers (I don't know in advance). And I have troubles with array of same double number, for example:
double_numbers = np.array([1e20] * 20)
np.histogram(double_numbers, bins=100)
I get an error:
IndexError Traceback (most recent call last)
<ipython-input-37-51958daa5f2c> in <module>()
1 double_numbers = np.array([1e20] * 20)
----> 2 np.histogram(double_numbers, bins=100)
/home/oleksandr/.pyenv/versions/2.7.8/envs/dr2.7.8/lib/python2.7/site-packages/numpy/lib/function_base.pyc in histogram(***failed resolving arguments***)
795 # The index computation is not guaranteed to give exactly
796 # consistent results within ~1 ULP of the bin edges.
--> 797 decrement = tmp_a_data < bin_edges[indices]
798 indices[decrement] -= 1
799 # The last bin includes the right edge. The other bins do not.
IndexError: index -9223372036854775808 is out of bounds for axis 1 with size 101
Why numpy.histogram try to get value with index -9223372036854775808 (min number of int64)? Is there a bug of numpy?
This is a known bug https://github.com/numpy/numpy/issues/8627, exists already about 2 years