If I have a data frame with only number of clicks at certain fixed time interval looking like this:
1
3
4
2
6
1
And I want to calculate their rolling average with the 5 rows above, would this be legit:
SELECT AVG(value) OVER (ORDER BY 1 ASC ROWS 4 PRECEDING ) AS avg_value FROM df GROUP BY 1
Or should it be
SELECT AVG(value) OVER (PARTITION BY 1 ASC ROWS 4 PRECEDING) AS avg_value FROM df GROUP BY 1