Background
I want to perform a calculation on a Pandas Series. This calculation involves min
and max
. The calculation is used twice. In both cases it is the same calculation except for the min
or max
functions, which should be different.
I've created a function to perform this calculation:
def my_calc(my_series):
return my_series.rolling(...).max()
The problem
I don't know how to pass max
as a parameter of my_calc
.
Attempts
- This solution works only for basic operators.
- Currently I use
my_calc(my_series).max()
andmy_calc(my_series).min()