diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-06-26 09:03:37 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-06-26 09:03:37 -0700 |
commit | 431740e8a04855f8cdf2f720752e462a9cf69269 (patch) | |
tree | 902624894a3c43b90f842031e4c19144dad65acb /numpy | |
parent | 494e96a87fb6e5a4789354482e95a6a1d10cb23f (diff) | |
download | numpy-431740e8a04855f8cdf2f720752e462a9cf69269.tar.gz |
BUG: Fix incorrect deprecation logic for histogram(normed=...)
Fixes #11426, which was introduced in #11323 and #11352
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/histograms.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_histograms.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py index b7d9c4406..8b5aa602a 100644 --- a/numpy/lib/histograms.py +++ b/numpy/lib/histograms.py @@ -782,7 +782,7 @@ def histogram(a, bins=10, range=None, normed=None, weights=None, "The normed argument is ignored when density is provided. " "In future passing both will result in an error.", DeprecationWarning, stacklevel=2) - normed = False + normed = None if density: db = np.array(np.diff(bin_edges), float) diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py index adaa7e3bd..63004deb5 100644 --- a/numpy/lib/tests/test_histograms.py +++ b/numpy/lib/tests/test_histograms.py @@ -78,6 +78,10 @@ class TestHistogram(object): assert_array_equal(a, .1) assert_equal(np.sum(a * np.diff(b)), 1) + # Test that passing False works too + a, b = histogram(v, bins, density=False) + assert_array_equal(a, [1, 2, 3, 4]) + # Variale bin widths are especially useful to deal with # infinities. v = np.arange(10) |