diff options
author | Stephan Hoyer <shoyer@google.com> | 2019-06-11 21:13:12 -0400 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2019-06-11 21:13:18 -0400 |
commit | 080bf0064b64c3c95499473101c297c3d10e5348 (patch) | |
tree | eeb1e1215708c7bf66b9ec540b59261c4ed4a1f8 /numpy/lib/histograms.py | |
parent | bc3c7176987a5017126abbc861458fe53cd099fc (diff) | |
download | numpy-080bf0064b64c3c95499473101c297c3d10e5348.tar.gz |
MAINT: fix histogram*d dispatchers
fixes GH-13728
Diffstat (limited to 'numpy/lib/histograms.py')
-rw-r--r-- | numpy/lib/histograms.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py index 5bcedc7f4..478fbc783 100644 --- a/numpy/lib/histograms.py +++ b/numpy/lib/histograms.py @@ -3,6 +3,7 @@ Histogram-related functions """ from __future__ import division, absolute_import, print_function +import contextlib import functools import operator import warnings @@ -922,7 +923,13 @@ def histogram(a, bins=10, range=None, normed=None, weights=None, def _histogramdd_dispatcher(sample, bins=None, range=None, normed=None, weights=None, density=None): - return (sample, bins, weights) + if hasattr(sample, 'shape'): # same condition as used in histogramdd + yield sample + else: + yield from sample + with contextlib.supress(TypeError): + yield from bins + yield weights @array_function_dispatch(_histogramdd_dispatcher) |