Histogram of CuDF with groupby fails
See original GitHub issueALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
hvplot 0.6 bokeh 2.2 cudf 0.15.0a+4572.gafb3928f6 (should be equiv with 0.15 or 0.16)
Description of expected behavior and the observed behavior
hvplot.hist
on a CuDF Datframe fails if a by
argument is supplied (works without a by
argument)
Complete, minimal, self-contained example code that reproduces the issue
import cudf
import hvplot.cudf
df = cudf.DataFrame({"x": [1,2,1,3,4,5], "v": [0,0,0, 1,1,1]})
df.hvplot.hist(y="x", by="v")
Edit: updated “v” column to not be string since CuDF does not support string arrays yet
Stack traceback and/or browser JavaScript console output
TypeError: Series object is not iterable. Consider using `.to_arrow()`, `.to_pandas()` or `.values_host` if you wish to iterate over the values.
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/hvplot/plotting/core.py in hist(self, y, by, **kwds) 399 The HoloViews representation of the plot. 400 “”" –> 401 return self(kind=‘hist’, x=None, y=y, by=by, **kwds) 402 403 def kde(self, y=None, by=None, **kwds):
~/anaconda/envs/cuxfdev/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):
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/hvplot/converter.py in call(self, kind, x, y) 1022 dataset = Dataset(data) 1023 dataset = dataset.redim(**self._redim) -> 1024 obj = method(x, y) 1025 obj._dataset = dataset 1026
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/hvplot/converter.py in hist(self, x, y, data) 1472 if self.by: 1473 hist = hists = histogram( -> 1474 ds.groupby(self.by), dimension=y, **hist_opts 1475 ) 1476 hist = hists.last
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/holoviews/core/data/init.py in pipelined_fn(*args, **kwargs) 214 215 try: –> 216 result = method_fn(*args, **kwargs) 217 218 op = method_op.instance(
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/holoviews/core/data/init.py in groupby(self, dimensions, container_type, group_type, dynamic, **kwargs) 969 970 return self.interface.groupby(self, dim_names, container_type, –> 971 group_type, **kwargs) 972 973 def transform(self, *args, **kwargs):
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/holoviews/core/data/cudf.py in groupby(cls, dataset, dimensions, container_type, group_type, **kwargs) 164 165 # Find all the keys along supplied dimensions –> 166 keys = product(*(dataset.data[dimensions[0]].unique() for d in dimensions)) 167 168 # Iterate over the unique entries applying selection masks
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/cudf/core/series.py in iter(self) 801 802 def iter(self): –> 803 cudf.utils.utils.raise_iteration_error(obj=self) 804 805 iteritems = iter
~/anaconda/envs/cuxfdev/lib/python3.7/site-packages/cudf/utils/utils.py in raise_iteration_error(obj)
435 def raise_iteration_error(obj):
436 raise TypeError(
–> 437 f"{obj.class.name} object is not iterable. "
438 f"Consider using .to_arrow()
, .to_pandas()
or .values_host
"
439 f"if you wish to iterate over the values."
TypeError: Series object is not iterable. Consider using .to_arrow()
, .to_pandas()
or .values_host
if you wish to iterate over the values.
</details>
#### Screenshots or screencasts of the bug in action
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
@philippjfr can you move this to holoviews?
It seems like this was fixed but never closed 🙃