Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

module 'pandas' has no attribute 'rolling_apply' [duplicate]

Tags:

python

pandas

I am using pandas with version 0.23.4 and the below code is giving me the error - "module 'pandas' has no attribute 'rolling_apply'"

Below is the function call:

df['perLow'] = pd.rolling_apply(df.low, 2, add_percentage_diff)

Any help with fixing this error is much appreciated.

like image 393
Nikicatz Avatar asked Oct 16 '25 15:10

Nikicatz


1 Answers

The pd.rolling_* family of functions were replaced by Rolling objects associated with DataFrames around v0.18.

Use Rolling.apply:

df['low'].rolling(2).apply(add_percentage_diff)
like image 170
cs95 Avatar answered Oct 18 '25 10:10

cs95



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!