From d34208005cb6f7f3ad73d6548f2a02c15652dc1b Mon Sep 17 00:00:00 2001 From: maximlt Date: Tue, 2 Jul 2024 14:09:33 +0200 Subject: [PATCH] test multi-index groupby --- hvplot/tests/testcharts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hvplot/tests/testcharts.py b/hvplot/tests/testcharts.py index 4c61d1205..2fddea515 100644 --- a/hvplot/tests/testcharts.py +++ b/hvplot/tests/testcharts.py @@ -134,6 +134,10 @@ def setUp(self): self.cat_only_df = pd.DataFrame( [['A', 'a'], ['B', 'b'], ['C', 'c']], columns=['upper', 'lower'] ) + multii_df = pd.DataFrame( + {'A': [1, 2, 3, 4], 'B': ['a', 'a', 'b', 'b'], 'C': [0, 1, 2, 1.5]} + ) + self.multii_df = multii_df.set_index(['A', 'B']) self.time_df = pd.DataFrame( { 'time': pd.date_range('1/1/2000', periods=10, tz='UTC'), @@ -451,6 +455,14 @@ def test_labels_by_subplots(self): ) assert isinstance(plot, NdLayout) + def test_multi_index_groupby_from_index(self): + hmap = self.multii_df.hvplot.scatter(x='A', y='C', groupby='B', dynamic=False) + assert hmap.kdims == ['B'] + assert hmap.vdims == [] + assert list(hmap.keys()) == ['a', 'b'] + assert hmap.last.kdims == ['A'] + assert hmap.last.vdims == ['C'] + class TestChart1DDask(TestChart1D): def setUp(self): @@ -468,3 +480,6 @@ def setUp(self): def test_by_datetime_accessor(self): raise SkipTest("Can't expand dt accessor columns when using dask") + + def test_multi_index_groupby_from_index(self): + raise SkipTest('Dask does not support MultiIndex Dataframes.')