Skip to content

Commit

Permalink
test multi-index groupby
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed Jul 2, 2024
1 parent e53a4d2 commit d342080
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions hvplot/tests/testcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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):
Expand All @@ -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.')

0 comments on commit d342080

Please sign in to comment.