Home > Net >  pandas dataframe add a column computing the median from the first row
pandas dataframe add a column computing the median from the first row

Time:11-19

I have a dataframe with a column filled with floats. I want to add a column which computes the median from the first row to the current row. I do no want to compute a rolling median but the median with all the inforamtion known ar each step.

CodePudding user response:

You can check with expanding

df['your col'].expanding().median()
  • Related