8000 BUG: Regression with np.histogram for value at end point · Issue #7674 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: Regression with np.histogram for value at end point #7674
Closed
@astrofrog

Description

@astrofrog

The following simple example no longer works:

np.histogram([ 0.,  0.,  0.,  1.,  2.,  3.,  3.,  4.,  5.], bins=30, range=(-0.5, 5))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-7ea9ff24a0b8> in <module>()
----> 1 np.histogram([ 0.,  0.,  0.,  1.,  2.,  3.,  3.,  4.,  5.], bins=30, range=(-0.5, 5))

/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/numpy/lib/function_base.py in histogram(a, bins, range, normed, weights, density)
    683                 n.imag += np.bincount(indices, weights=tmp_w.imag, minlength=bins)
    684             else:
--> 685                 n += np.bincount(indices, weights=tmp_w, minlength=bins).astype(ntype)
    686 
    687         # Rename the bin edges for return.

ValueError: operands could not be broadcast together with shapes (30,) (31,) (30,) 

I think this is a result of #7667, and is a bug due to the 5 not being correctly identified as an end point.

cc @rkern @charris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0