import pandas as pd
import panel as pn
import param
class MyObject(param.Parameterized):
data = param.DataFrame()
my_object = MyObject(data=pd.DataFrame({"a": [1, 2, 3]}))
tabulator = pn.widgets.Tabulator.from_param(my_object.param.data)
tabulator.value = pd.DataFrame({"a": [1, 2, 5]})
Traceback (most recent call last):
File "***/test.py", line 14, in <module>
tabulator.value = pd.DataFrame({"a": [1, 2, 5]})
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/param/parameterized.py", line 2970, in trigger
self_.update(dict(params, **triggers))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/param/parameterized.py", line 2788, in update
restore = dict(self_._update(arg, **kwargs))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/param/parameterized.py", line 2821, in _update
self_._batch_call_watchers()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "***/.venv/lib/python3.13/site-packages/param/parameterized.py", line 3038, in _batch_call_watchers
self_._execute_watcher(watcher, events)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/param/parameterized.py", line 3000, in _execute_watcher
watcher.fn(*args, **kwargs)
~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/panel/param.py", line 575, in link_widget
if not reset and current_val != new:
^^^^^^^^^^^^^^^^^^
File "***/.venv/lib/python3.13/site-packages/pandas/core/generic.py", line 1513, in __bool__
raise ValueError(
...<2 lines>...
)
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
ALL software version info
Software Version Info
Description of expected behavior and the observed behavior
When I create a Tabulator with
Tabulator.from_param, updating the value fails withValueError.#8492 introduced a comparison between the current and the new value and expected to result to be a bool (see
panel/param.py:575). In this case the values are DataFrames that do not return a bool but another DataFrame (type(pd.DataFrame() != pd.DataFrame()) == pd.DataFrame).Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output