Почему numpy.histogram пытается получить значение с индексом -9223372036854775808 (минимальное число int64)? - PullRequest
0 голосов
/ 01 ноября 2018

Моя задача - подсчитать гистограмму для разных массивов чисел (заранее не знаю). И у меня проблемы с массивом с таким же двойным числом, например:

double_numbers = np.array([1e20] * 20)
np.histogram(double_numbers, bins=100)

Я получаю сообщение об ошибке:

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

Почему numpy.histogram пытается получить значение с индексом -9223372036854775808 (минимальное число int64)? Есть ли ошибка numpy?

1 Ответ

0 голосов
/ 01 ноября 2018

Это известная ошибка https://github.com/numpy/numpy/issues/8627, существует уже около 2 лет

...