Freeze Column Table Argument Not Working as Expected
I'm trying to use the
freeze_columns_left
argument in mo.ui.table
, and I am not getting an error, but the specified column is not frozen. This is my code. Can you tell me why?19 Replies
I think you forgot to add
freeze_columns_left=["Name"]
inside the if condition 🤔That is 100% true, I thought I was testing with something that didn't meet the condition but maybe not because I just walked away and came back and it was working 🤦🏼♀️
Is it possible to make the dataframe's index freeze?
You are using
polars
right?
maybe you can try
I think you need to create a new cell and run the code there
Edit in-place doesn't change the pinning, but seems to be fixed in the next releaseI was using pandas!
sorry, I saw you were indexing with
mask
so assumed that you were using polars
then
should work?Sorry, I was following a tutorial on how to "mask" a data frame table to only show values selected on a plotly chart! I will probably not get back to this until later today but will try that out.
I didn't get this to work - just to clarify, I'm referring to the dataframe index, not a column called index
for context, I'm trying to get the column called "Number" (which is the dataframe index) to freeze on the left
In this case, just
freeze_columns_left=["Number, "Name"]
should work?df.reset_index()
should automatically generate a column named "index"this is what I get
and this is what I get when I try this
is "Number" in
team_df2[mask].columns
?
also, you forgot ()
inside the if condition for reset_index
my bad on
reset_index
, but fixing that still didn't change the behavior. and no, it is not in team_df2[mask]
because it is the dataframe's indexmy bad, have limited experience with pandas
the only solution I can come of is setting "Number" to a regular column instead of index
I think
freeze_columns_left
ignores index column for pandasis there a way to not display the index in the table then? because if it isn't the index, then it wants to show a serialized/default index column in the table also
maybe
this should reset the "Number" index to a regular column
So this is kind of working as I expected..... the thing I am finding weird is that if I put index in the freeze list after using
reset_index
, it does freeze the auto-assigned index.for some reason you only cannot assign
index
in freeze_columns_left
when index is defined by a dataframe column, not when the default auto-assigned index is used