Tabulator aggregators: allow nested dict, fix data aggregation #12213
Annotations
4 errors
Test Examples:
examples/reference/widgets/Tabulator.ipynb#L1
examples/reference/widgets/Tabulator.ipynb::Cell 47
Notebook cell execution failed
Cell 47: Cell execution caused an exception
Input:
tabulator_editors = {
'float': {'type': 'number', 'max': 10, 'step': 0.1},
'bool': {'type': 'tickCross', 'tristate': True, 'indeterminateValue': None},
'str': {'type': 'list', 'valuesLookup': True},
}
header_filter_table = pn.widgets.Tabulator(
df[['float', 'bool', 'str']], height=140, width=400, layout='fit_columns',
editors=tabulator_editors, header_filters=True
)
header_filter_table
Traceback:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[1], line 8
1 tabulator_editors = {
2 'float': {'type': 'number', 'max': 10, 'step': 0.1},
3 'bool': {'type': 'tickCross', 'tristate': True, 'indeterminateValue': None},
4 'str': {'type': 'list', 'valuesLookup': True},
5 }
7 header_filter_table = pn.widgets.Tabulator(
----> 8 df[['float', 'bool', 'str']], height=140, width=400, layout='fit_columns',
9 editors=tabulator_editors, header_filters=True
10 )
11 header_filter_table
File ~/work/panel/panel/.pixi/envs/test-312/lib/python3.12/site-packages/pandas/core/frame.py:4108, in DataFrame.__getitem__(self, key)
4106 if is_iterator(key):
4107 key = list(key)
-> 4108 indexer = self.columns._get_indexer_strict(key, "columns")[1]
4110 # take() does not accept boolean indexers
4111 if getattr(indexer, "dtype", None) == bool:
File ~/work/panel/panel/.pixi/envs/test-312/lib/python3.12/site-packages/pandas/core/indexes/base.py:6200, in Index._get_indexer_strict(self, key, axis_name)
6197 else:
6198 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
-> 6200 self._raise_if_missing(keyarr,�[4
|
Test Examples:
examples/reference/widgets/Tabulator.ipynb#L1
examples/reference/widgets/Tabulator.ipynb::Cell 54
Notebook cell execution failed
Cell 54: Cell execution caused an exception
Input:
patch_table = pn.widgets.Tabulator(df[['int', 'float', 'str', 'bool']].copy())
patch_table
Traceback:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[1], line 1
----> 1 patch_table = pn.widgets.Tabulator(df[['int', 'float', 'str', 'bool']].copy())
2 patch_table
File ~/work/panel/panel/.pixi/envs/test-312/lib/python3.12/site-packages/pandas/core/frame.py:4108, in DataFrame.__getitem__(self, key)
4106 if is_iterator(key):
4107 key = list(key)
-> 4108 indexer = self.columns._get_indexer_strict(key, "columns")[1]
4110 # take() does not accept boolean indexers
4111 if getattr(indexer, "dtype", None) == bool:
File ~/work/panel/panel/.pixi/envs/test-312/lib/python3.12/site-packages/pandas/core/indexes/base.py:6200, in Index._get_indexer_strict(self, key, axis_name)
6197 else:
6198 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
-> 6200 self._raise_if_missing(keyarr, indexer, axis_name)
6202 keyarr = self.take(indexer)
6203 if isinstance(key, Index):
6204 # GH 42790 - Preserve name from an Index
File ~/work/panel/panel/.pixi/envs/test-312/lib/python3.12/site-packages/pandas/core/indexes/base.py:6249, in Index._raise_if_missing(self, key, indexer, axis_name)
6247 if nmissing:
6248 if nmissing == len(indexer):
-> 6249 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6251 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
6252 raise KeyError(f"{not_found} not in index")
KeyError: "None of [Index(['int', 'float', 'str', 'bool'], dtype='object')] are in the [columns]"
|
Test Examples:
examples/reference/widgets/Tabulator.ipynb#L1
examples/reference/widgets/Tabulator.ipynb::Cell 55
Notebook cell execution failed
Cell 55: Cell execution caused an exception
Input:
patch_table.patch({
'bool': [
(0, False),
(2, False)
],
'int': [
(slice(0, 2), [3, 2])
]
}, as_index=False)
Traceback:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[1], line 1
----> 1 patch_table.patch({
2 'bool': [
3 (0, False),
4 (2, False)
5 ],
6 'int': [
7 (slice(0, 2), [3, 2])
8 ]
9 }, as_index=False)
NameError: name 'patch_table' is not defined
|
Test Examples
Process completed with exit code 1.
|
Loading