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
There's code in the converter to support hierarchical columns in a Pandas DataFrame, however it's untested and I think support for this kind of structure broke at some point.
[/Users/mliquet/dev/hvplot/hvplot/converter.py:1225](http://localhost:8888/Users/mliquet/dev/hvplot/hvplot/converter.py#line=1224): FutureWarning: The previous implementation of stack is deprecated and will be removed in a future version of pandas. See the What's New notes for pandas 2.1.0 for details. Specify future_stack=True to adopt the new implementation and silence this warning.self.data=data.stack().reset_index(1).rename(columns={'level_1': group_label})
---------------------------------------------------------------------------DataErrorTraceback (mostrecentcalllast)
File [~/dev/hvplot/hvplot/converter.py:1666](http://localhost:8888/lab/tree/~/dev/hvplot/hvplot/converter.py#line=1665), in HoloViewsConverter.__call__(self, kind, x, y)1665try:
->1666dataset=Dataset(data, self.indexes)
1667exceptException:
File [~/dev/holoviews/holoviews/core/data/__init__.py:329](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/__init__.py#line=328), in Dataset.__init__(self, data, kdims, vdims, **kwargs)328validate_vdims=kwargs.pop('_validate_vdims', True)
-->329initialized=Interface.initialize(type(self), data, kdims, vdims,
330datatype=kwargs.get('datatype'))
331 (data, self.interface, dims, extra_kws) =initializedFile [~/dev/holoviews/holoviews/core/data/interface.py:253](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/interface.py#line=252), in Interface.initialize(cls, eltype, data, kdims, vdims, datatype)252try:
-->253 (data, dims, extra_kws) =interface.init(eltype, data, kdims, vdims)
254breakFile [~/dev/holoviews/holoviews/core/data/pandas.py:69](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/pandas.py#line=68), in PandasInterface.init(cls, eltype, data, kdims, vdims)68ifany(notisinstance(d, (str, Dimension)) fordinkdims+vdims):
--->69raiseDataError(
70"Having a non-string as a column name in a DataFrame is not supported."71 )
73ifkdimsandnot (len(kdims) ==len(index_names) and {dimension_name(kd) forkdinkdims} ==set(index_names)):
DataError: Havinganon-stringasacolumnnameinaDataFrameisnotsupported.
Duringhandlingoftheaboveexception, anotherexceptionoccurred:
DataErrorTraceback (mostrecentcalllast)
CellIn[3], line1---->1df.hvplot.scatter()
File [~/dev/hvplot/hvplot/plotting/core.py:576](http://localhost:8888/lab/tree/~/dev/hvplot/hvplot/plotting/core.py#line=575), in hvPlotTabular.scatter(self, x, y, **kwds)471defscatter(self, x=None, y=None, **kwds):
472""" 473 The `scatter` plot visualizes your points as markers in 2D space. You can visualize 474 one more dimension by using colors. (...) 574 - Wiki: https://en.wikipedia.org/wiki/Scatter_plot 575 """-->576returnself(x, y, kind='scatter', **kwds)
File~/dev/hvplot/hvplot/plotting/core.py:95, inhvPlotBase.__call__(self, x, y, kind, **kwds)
92plot=self._get_converter(x, y, kind, **kwds)(kind, x, y)
93returnpn.panel(plot, **panel_dict)
--->95returnself._get_converter(x, y, kind, **kwds)(kind, x, y)
File [~/dev/hvplot/hvplot/converter.py:1668](http://localhost:8888/lab/tree/~/dev/hvplot/hvplot/converter.py#line=1667), in HoloViewsConverter.__call__(self, kind, x, y)1666dataset=Dataset(data, self.indexes)
1667exceptException:
->1668dataset=Dataset(data)
1669dataset=dataset.redim(**self._redim)
1671obj=method(x, y)
File [~/dev/holoviews/holoviews/core/data/__init__.py:329](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/__init__.py#line=328), in Dataset.__init__(self, data, kdims, vdims, **kwargs)326kdims, vdims=kwargs.get('kdims'), kwargs.get('vdims')
328validate_vdims=kwargs.pop('_validate_vdims', True)
-->329initialized=Interface.initialize(type(self), data, kdims, vdims,
330datatype=kwargs.get('datatype'))
331 (data, self.interface, dims, extra_kws) =initialized332super().__init__(data, **dict(kwargs, **dict(dims, **extra_kws)))
File [~/dev/holoviews/holoviews/core/data/interface.py:253](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/interface.py#line=252), in Interface.initialize(cls, eltype, data, kdims, vdims, datatype)251continue252try:
-->253 (data, dims, extra_kws) =interface.init(eltype, data, kdims, vdims)
254break255exceptDataError:
File [~/dev/holoviews/holoviews/core/data/pandas.py:69](http://localhost:8888/lab/tree/~/dev/holoviews/holoviews/core/data/pandas.py#line=68), in PandasInterface.init(cls, eltype, data, kdims, vdims)66vdims=list(data.columns[:nvdimifnvdimelseNone])
68ifany(notisinstance(d, (str, Dimension)) fordinkdims+vdims):
--->69raiseDataError(
70"Having a non-string as a column name in a DataFrame is not supported."71 )
73ifkdimsandnot (len(kdims) ==len(index_names) and {dimension_name(kd) forkdinkdims} ==set(index_names)):
74kdim=dimension_name(kdims[0])
DataError: Havinganon-stringasacolumnnameinaDataFrameisnotsupported.
The text was updated successfully, but these errors were encountered:
There's code in the converter to support hierarchical columns in a Pandas DataFrame, however it's untested and I think support for this kind of structure broke at some point.
hvplot/hvplot/converter.py
Lines 1221 to 1229 in 6c96c7e
Trying to plot a DataFrame with this structure
Traceback:
The text was updated successfully, but these errors were encountered: