Home > Mobile >  What is the most efficient and Pythonic way of calculating limsup/liminf in pandas?
What is the most efficient and Pythonic way of calculating limsup/liminf in pandas?

Time:08-25

enter image description here

CodePudding user response:

Reverse the values and use cummax to get the cumulative maximum:

df["lim_sup"] = df.loc[::-1, "value"].cummax()
  • Related