Hello,
In the course 'Python for Trading : Basic', Section 8, Unit 12, I would like to highlight 2 codes:
- Rolling mean
The syntax for rolling mean in the course is:
pd.rolling_mean(infy["Close Price"],20).plot()
which is not working and throwing the error- AttributeError: module 'pandas' has no attribute 'rolling_mean'
However, the below code works:
infy["Close Price"].rolling(20).mean().plot()
- Expanding mean
The syntax for expanding mean in the course is:
pd.expanding_mean( infy ["Close Price"], min_periods = 20)
which is not working and throwing the error- AttributeError: module 'pandas' has no attribute 'expanding_mean'
The below code works:
infy["Close Price"].expanding(20).mean().plot()
Please make the required correction if it's correct.