Open JanHomann opened 2 years ago
I just wanted to add that this here works:
dfi.loc[dfi.mean(axis=1) > threshold]
But this here doesn't:
dfi.loc[dfi.mean(axis=1) > threshold,:]
Note: In both cases, you should set the starting point of the slider values a bit lower to see something:
threshold = pn.widgets.IntSlider(start=-10, end=50, value=0)
@maximlt The interactive DataFrames get rendered now, and they are filtered, but the interactivity in the filtering still does not work. When I move the slider, the interactive DataFrame does not update.
A workaround that I came up with is:
dfi.T.loc[dfi.mean() > threshold].T
This is equivalent to the original code that does not work:
dfi.loc[:,dfi.mean() > threshold]
So you transpose the dataframe before the operation and apply the dynamic filtering on the rows instead of the columns, and transpose it back after the operation.
Versions
Description
Filtering an interactive dataframe using a comparison operator using
.loc
fails, probably due to issues with the boolean interactive dataframe that is generated as an intermediate step.Example
Stack traceback for all three cases
case 1
case 2
Case 3