Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabulator and dataframe widget error on edit and won't update anymore #6711

Closed
JulienLrx opened this issue Apr 11, 2024 · 3 comments
Closed

Comments

@JulienLrx
Copy link

JulienLrx commented Apr 11, 2024

Editing a cell in the tabulator widget throw a key error.

python 3.11.8
Panel 1.4.1
Bokeh 3.4.0
jupyter-bokeh 4.0.1

simple code used to reproduce the error (error is thrown upon exiting the cell) :

df = pd.DataFrame({
    "selected": [True, False, True],
    "Titre": ["TED1", "TED2", "TED3"],
    "id": [1, 2, 3],
    "check": [True, False, True]
}, index=[1, 2, 3])

pn.widgets.Tabulator(df).servable()

stack :

`File /opt/conda/lib/python3.11/site-packages/jupyter_bokeh/widgets.py:162, in BokehModel._sync_model(self, _model, content, _buffers)
    160 elif kind == "ColumnsPatched":
    161     model = content["model"]
--> 162     patches = content["data"]
    164     assert isinstance(model, ColumnDataSource)
    165     model.patch(patches, setter=setter)

KeyError: 'data'`

@JulienLrx JulienLrx changed the title Tabulator key on edit Tabulator throws a key error on edit Apr 11, 2024
@JulienLrx
Copy link
Author

Same problem with the dataframe widget (pn.widgets.DataFrame).
Also the tabulator or the dataframe won't update anymore after a cell has been edited. (both with implicit and explicit linking)

simple exemple :

df = pd.DataFrame({
    "selected": [True, False, True],
    "Score": [3.14, 6.28, 9.42],
    "Titre": ["TED1", "TED2", "TED3"]
}, index=[1, 2, 3])

df2 = pd.DataFrame({
    "selected": [True, False, True],
    "Score": [3.14, 6.28, 9.42],
    "Titre": ["GGG1", "GGG2", "GGG3"]
}, index=[1, 2, 3])


def get_data(select):
    if select == "test1":
        return df
    else:
        return df2

select = pn.widgets.Select(name="base",options=["test1","test2"])
table = pn.widgets.DataFrame(pn.bind(get_data,select))
pn.FlexBox(select,table)

@JulienLrx JulienLrx changed the title Tabulator throws a key error on edit Tabulator and dataframe widget throw error after editing a cell and won't update anymore Apr 12, 2024
@JulienLrx JulienLrx changed the title Tabulator and dataframe widget throw error after editing a cell and won't update anymore Tabulator and dataframe widget error on edit and won't update anymore Apr 12, 2024
@earshinov
Copy link

Duplicates #5513

@maximlt
Copy link
Member

maximlt commented May 31, 2024

Indeed it's a duplicate, closing in favor of #5513.

@maximlt maximlt closed this as completed May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants