You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of expected behavior and the observed behavior
NumPy's histogram function accepts the keyword argument bins="auto". I would expect the same from Holoviews (especially because it looks like Holoviews relies on np.histogram).
However, Holoviews throws an error when df.plot(..., kind="hist", bins="auto") is called.
Complete, minimal, self-contained example code that reproduces the issue
~/anaconda3/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_bin_edges(a, bins, range, weights)
423 except TypeError:
424 raise TypeError(
--> 425 '`bins` must be an integer, a string, or an array')
426 if n_equal_bins < 1:
427 raise ValueError('`bins` must be positive, when an integer')
TypeError: `bins` must be an integer, a string, or an array
Here's the complete traceback:
---------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_bin_edges(a, bins, range, weights)
421 try:
--> 422 n_equal_bins = operator.index(bins)
423 except TypeError:
TypeError: only integer scalar arrays can be converted to a scalar index
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-51-108281d3bae9> in <module>
----> 1 df["x"].hvplot(kind="hist", bins="auto") # fails
~/anaconda3/lib/python3.7/site-packages/hvplot/plotting/core.py in __call__(self, x, y, kind, **kwds)
70 return pn.panel(plot, **panel_dict)
71
---> 72 return self._get_converter(x, y, kind, **kwds)(kind, x, y)
73
74 def _get_converter(self, x=None, y=None, kind=None, **kwds):
~/anaconda3/lib/python3.7/site-packages/hvplot/converter.py in __call__(self, kind, x, y)
942 obj = DynamicMap(cbcallable, streams=[self.stream])
943 else:
--> 944 obj = method(x, y)
945
946 if self.crs and self.project:
~/anaconda3/lib/python3.7/site-packages/hvplot/converter.py in hist(self, x, y, data)
1388 hists = hists.layout() if self.subplots else hists.overlay()
1389 else:
-> 1390 hists = histogram(ds, dimension=y, **hist_opts)
1391
1392 return hists.opts(opts).redim(**self._redim)
~/anaconda3/lib/python3.7/site-packages/param/parameterized.py in __new__(class_, *args, **params)
2810 inst = class_.instance()
2811 inst.param._set_name(class_.__name__)
-> 2812 return inst.__call__(*args,**params)
2813
2814 def __call__(self,*args,**kw):
~/anaconda3/lib/python3.7/site-packages/holoviews/core/operation.py in __call__(self, element, **kwargs)
194 kwargs['streams'] = self.p.streams
195 kwargs['per_element'] = self._per_element
--> 196 return element.apply(self, **kwargs)
197
198
~/anaconda3/lib/python3.7/site-packages/holoviews/core/accessors.py in pipelined_call(*args, **kwargs)
43
44 try:
---> 45 result = __call__(*args, **kwargs)
46
47 if not in_method:
~/anaconda3/lib/python3.7/site-packages/holoviews/core/accessors.py in __call__(self, apply_function, streams, link_inputs, dynamic, per_element, **kwargs)
196 if hasattr(apply_function, 'dynamic'):
197 inner_kwargs['dynamic'] = False
--> 198 return apply_function(self._obj, **inner_kwargs)
199 elif self._obj._deep_indexable:
200 mapped = []
~/anaconda3/lib/python3.7/site-packages/holoviews/core/operation.py in __call__(self, element, **kwargs)
190 elif ((self._per_element and isinstance(element, Element)) or
191 (not self._per_element and isinstance(element, ViewableElement))):
--> 192 return self._apply(element)
193 elif 'streams' not in kwargs:
194 kwargs['streams'] = self.p.streams
~/anaconda3/lib/python3.7/site-packages/holoviews/core/operation.py in _apply(self, element, key)
130 element_pipeline = getattr(element, '_pipeline', None)
131
--> 132 ret = self._process(element, key)
133 for hook in self._postprocess_hooks:
134 ret = hook(self, ret, **kwargs)
~/anaconda3/lib/python3.7/site-packages/holoviews/operation/element.py in _process(self, element, key)
753 hist /= hist.max()
754 else:
--> 755 hist, edges = histogram(data, normed=normed, weights=weights, bins=edges)
756 if self.p.weight_dimension and self.p.mean_weighted:
757 hist_mean, _ = histogram(data, density=False, bins=self.p.num_bins)
<__array_function__ internals> in histogram(*args, **kwargs)
~/anaconda3/lib/python3.7/site-packages/numpy/lib/histograms.py in histogram(a, bins, range, normed, weights, density)
793 a, weights = _ravel_and_check_weights(a, weights)
794
--> 795 bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights)
796
797 # Histogram is an integer or a float array depending on the weights.
~/anaconda3/lib/python3.7/site-packages/numpy/lib/histograms.py in _get_bin_edges(a, bins, range, weights)
423 except TypeError:
424 raise TypeError(
--> 425 '`bins` must be an integer, a string, or an array')
426 if n_equal_bins < 1:
427 raise ValueError('`bins` must be positive, when an integer')
TypeError: `bins` must be an integer, a string, or an array
The text was updated successfully, but these errors were encountered:
All software version info
Description of expected behavior and the observed behavior
NumPy's histogram function accepts the keyword argument
bins="auto"
. I would expect the same from Holoviews (especially because it looks like Holoviews relies onnp.histogram
).However, Holoviews throws an error when
df.plot(..., kind="hist", bins="auto")
is called.Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
Here's the error:
Here's the complete traceback:
The text was updated successfully, but these errors were encountered: