I have a dataframe with many columns, only interested in timestamp, country, province, and population.
I would like to determine the mean population over time by province. I can calculate this using the following in Polars: df.groupby(['timestamp','country', 'prov']).agg(pl.col('population').mean())
However I would like to incorporate rolling timewindows. I have found the following, but I am unsure if I can incorporate both into one expression. df.groupby_rolling('timestamp', period = '1y')
I am looking to find the mean by year, perhaps rolling window is not the correct terminology
Any suggestions?