From ea7fac99e65037699eefe97b714808f7c73bf147 Mon Sep 17 00:00:00 2001 From: Brandon Carter Date: Sat, 24 Jun 2017 23:13:38 -0400 Subject: BUG: fixes unsigned bins monotonicity check, see #9222 --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index a3db3494c..8bde521bf 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -782,7 +782,7 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, bins = bin_edges else: bins = asarray(bins) - if (np.diff(bins) < 0).any(): + if not np.all(bins[1:] > bins[:-1]): raise ValueError( 'bins must increase monotonically.') -- cgit v1.2.1 From e12f16df86301881ac72f6bcab8831e9f3e23a24 Mon Sep 17 00:00:00 2001 From: Brandon Carter Date: Sun, 25 Jun 2017 23:04:51 -0400 Subject: minor change to the logic --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8bde521bf..48922721f 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -782,7 +782,7 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, bins = bin_edges else: bins = asarray(bins) - if not np.all(bins[1:] > bins[:-1]): + if np.any(bins[1:] <= bins[:-1]): raise ValueError( 'bins must increase monotonically.') -- cgit v1.2.1 From 1a1db29588055021e4fde133ff0d65b3d881ff3d Mon Sep 17 00:00:00 2001 From: Brandon Carter Date: Sat, 19 Aug 2017 21:12:03 -0400 Subject: allow non-strictly increasing bins --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 48922721f..5b039ca23 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -782,7 +782,7 @@ def histogram(a, bins=10, range=None, normed=False, weights=None, bins = bin_edges else: bins = asarray(bins) - if np.any(bins[1:] <= bins[:-1]): + if np.any(bins[:-1] > bins[1:]): raise ValueError( 'bins must increase monotonically.') -- cgit v1.2.1