Doubt Reg : dataframe.rolling()


In “Week 12 - Line Plot COVID Data Video” of the FDS course we have the below code at the very start of the video.

`df = df.rolling(7).mean()`

Can you please explain what does the “rolling” fn. do??

And also elaborate on the above code.

Thanks & Regards.

Hi @chandra,
The snipet here is basically performing mean operation on a number of values.
These number of values are defined by the paratemer we pass in the function.
For a better elaboration with examples, please check Pandas dataframe.rolling() - GeeksforGeeks
Please let me know incase it doesn’t help.


Thank you so much for the quick help Sir.

Doubt cleared!!