Skip to content

rolling.apply deprecated in the future series rolling sugjested but doesn't work #19953

@josheeg

Description

@josheeg

Code Sample,

#series example then old example that threw the future warning commented out
housing_data['ma_apply_example'] = Series.rolling(window=10,center=False).apply(housing_data['M30'], moving_average)
#housing_data['ma_apply_example'] = pd.rolling_apply(housing_data['M30'], 125, moving_average)


error
C:/Users/josheeg/.spyder-py3/pyrollingstatstut15.py:42: FutureWarning: pd.rolling_apply is deprecated for Series and will be removed in a future version, replace with 
        Series.rolling(window=125,center=False).apply(func=<function>,args=<tuple>,kwargs=<dict>)
  housing_data['ma_apply_example'] = pd.rolling_apply(housing_data['M30'], 125, moving_average)

Problem description

[I am running anaconda python 64 bit in windows 10
I am trying pythonprogramming.net tutorial 15 rolling window apply
the future warning rolling_apply is being fased out for series.rolling but when I try what it sugjests I get a error.
C:/Users/josheeg/.spyder-py3/pyrollingstatstut15.py:42: FutureWarning: pd.rolling_apply is deprecated for Series and will be removed in a future version, replace with
Series.rolling(window=125,center=False).apply(func=,args=,kwargs=)
housing_data['ma_apply_example'] = pd.rolling_apply(housing_data['M30'], 125, moving_average)]

Error when I try that from my interpritation
File "C:/Users/josheeg/.spyder-py3/pyrollingstatstut15.py", line 50, in
housing_data['ma_apply_example'] = Series.rolling(window=10,center=False).apply(housing_data['M30'], moving_average)

TypeError: rolling() missing 1 required positional argument: 'self'

I updated all anaconda modules in anaconda navigator

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions