def test_groupby(test_data): ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**test_data.single_col_spec)) assert len(groups) == 5 ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**test_data.multi_col_spec)) assert len(groups) == 9
def test_groupby(test_data): ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**test_data.single_col_spec)) assert len(groups) == 5 ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**test_data.multi_col_spec)) assert len(groups) == 9
def test_groupby(test_data): # Note: this works because MarkerAttr and DashAttr are permissive in # what is accepted for iterable, i.e. List(String) for cls in (ColorAttr, MarkerAttr, DashAttr): single_col_spec = {'test': cls(df=test_data.auto_data, columns='cyl', name='test', iterable=['red', 'blue'])} multi_col_spec = {'test': cls(df=test_data.auto_data, columns=('cyl', 'origin'), name='test', iterable=['red', 'blue'])} ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**single_col_spec)) assert len(groups) == 5 ds = ChartDataSource(df=test_data.auto_data) groups = list(ds.groupby(**multi_col_spec)) assert len(groups) == 9