diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-03-26 00:18:37 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-03-26 00:50:39 -0700 |
commit | 89b402a9dab57c45eca0f942bde699ee6961a1f5 (patch) | |
tree | e23414e19e825606442cbb3d403d952c4fb16c52 /numpy/lib/histograms.py | |
parent | 88a564e81ba3b4eba7e1cd864e2ef68a39b572d1 (diff) | |
download | numpy-89b402a9dab57c45eca0f942bde699ee6961a1f5.tar.gz |
MAINT: Unify computation of `nbin[i]`
Diffstat (limited to 'numpy/lib/histograms.py')
-rw-r--r-- | numpy/lib/histograms.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py index c17683c7c..50bafec8c 100644 --- a/numpy/lib/histograms.py +++ b/numpy/lib/histograms.py @@ -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): |