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

Fix pandas warning when sorting filtered tabulator #6036

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

TBym
Copy link
Contributor

@TBym TBym commented Dec 13, 2023

When a Tabulator with applied filter(s) is sorted the code yields a warning from pandas "A value is trying to be set on a copy of a slice from a DataFrame".
This changes fixes the ussie by first sorting Tabulator data and then applying filter. Alternative is to create a copy of passed dataframe to _sort_df function.

It is possible to pass a function as a filter to tabulator but passing a functools.partial function currently fails. This update allows to pass both regular and partial function
When a Tabulator with applied filter(s) is sorted the code yields a warning from pandas "A value is trying to be set on a copy of a slice from a DataFrame".
This changes fixes the ussie by first sorting Tabulator data and then applying filter. Alternative is to create a copy of passed dataframe to _sort_df function.
When some of selected rows are filtered out in Tabulator calling selected_dataframe() raises error. This change makes the function to return all selected rows.
@TBym
Copy link
Contributor Author

TBym commented Dec 13, 2023

If you look to my branch I made a second commit fixing a bug in Tabulator selected_dataframe function. I tried to create two separate pull requests but it seems that I can create only single request for all my changes.

@cdeil
Copy link
Contributor

cdeil commented Mar 25, 2024

@TBym - do you have a minimal reproducer for the warning and issue you were getting?

Is the issue resolved in the meantime?

There have been a few tabulator fixes in the meantime, wee https://holoviz-dev.github.io/panel/about/releases.html or try with

pip install -U panel --pre

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

Successfully merging this pull request may close these issues.

None yet

2 participants