8000 BUG/DOC/MAINT: Tidy up histogramdd by eric-wieser · Pull Request #10802 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG/DOC/MAINT: Tidy up histogramdd #10802

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

Merged
merged 7 commits into from
Apr 7, 2018
Prev Previous commit
Next Next commit
MAINT: Unify computation of nbin[i]
  • Loading branch information
eric-wieser committed Mar 26, 2018
commit 89b402a9dab57c45eca0f942bde699ee6961a1f5
5 changes: 2 additions & 3 deletions numpy/lib/histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,10 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
if bins[i] < 1:
raise ValueError(
'`bins[{}]` must be positive, when an integer'.format(i))
nbin[i] = bins[i] + 2 # +2 for outlier bins
edges[i] = np.linspace(smin[i], smax[i], nbin[i]-1, dtype=edge_dt)
edges[i] = np.linspace(smin[i], smax[i], bins[i] + 1, dtype=edge_dt)
else:
edges[i] = np.asarray(bins[i], edge_dt)
nbin[i] = len(edges[i]) + 1 # +1 for outlier bins
nbin[i] = len(edges[i]) + 1 # includes an outlier on each end
dedges[i] = np.diff(edges[i])
# not just monotonic, due to the use of mindiff below
if np.any(np.asarray(dedges[i]) <= 0):
Expand Down
0