I want to create one column in my dataframe that’s always the same. Row 1 will always be 1, row 2 will be 2 and so on. Is there a way to do this where those column values will remain the same, even if a user sorts a different column?
It is possible to implement that by segmenting your data into 2 parts:
- Static part that will remain the same no matter what filter was applied
- Dynamic part that will change as user filters the data
Perform the above user filter and in the last step, use
pd.concat to combine the above 2 DataFrames together for a final display.
Hope this helps!