Let's say you have a dataset with the following column, Node, Time, date, Hour, Amount. Time is spaced hourly. date is simply the current date corresponding to Time. You should have only one instance of a Node per hour. Every day, for every Hour I want the average of Amount for the past 31 days in this hour. Here is the first thing I tried: df.rolling('Time', period='31d', group_by=['date', 'Hour']).agg(pl.col('Amount').mean()) I expected to get back one row per Hour per day, but I got the same amount of rows as the original df: What is it calculating exactly here and how can I do what I want it to do? Thanks! Continue reading...