diff options
author | Warren Weckesser <warren.weckesser@gmail.com> | 2019-08-27 15:15:26 -0400 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2019-10-15 17:42:58 -0400 |
commit | 3ff4924ead45ef6db81778daae08e3c939ea4629 (patch) | |
tree | 9e8c4c9726d1fbd8be32a75ce85a0314ac4c812d /numpy/polynomial/polyutils.py | |
parent | dc20ec8c857bc1f1b717b56f3a5c64dbf31f16ac (diff) | |
download | numpy-3ff4924ead45ef6db81778daae08e3c939ea4629.tar.gz |
BUG: lib: Fix histogram problem with signed integer arrays.
An input such as
np.histogram(np.array([-2, 0, 127], dtype=np.int8), bins="auto")
would raise the exception
ValueError: Number of samples, -1, must be non-negative.
The problem was that the peak-to-peak value for the input array was
computed with the `ptp` method, which returned negative values for
signed integer arrays when the actual value was more than the
maximum signed value of the array's data type.
The fix is to use a peak-to-peak function that returns an
unsigned value for signed integer arrays.
Closes gh-14379.
Diffstat (limited to 'numpy/polynomial/polyutils.py')
0 files changed, 0 insertions, 0 deletions