Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Regression with np.histogram for value at end point #7674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
astrofrog opened this issue May 25, 2016 · 0 comments
Closed

BUG: Regression with np.histogram for value at end point #7674

astrofrog opened this issue May 25, 2016 · 0 comments

Comments

@astrofrog
Copy link
Contributor

astrofrog commented May 25, 2016

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

@astrofrog astrofrog changed the title Regression with np.histogram BUG: Regression with np.histogram May 25, 2016
@astrofrog astrofrog changed the title BUG: Regression with np.histogram BUG: Regression with np.histogram for value at end point May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant