FunctionRacerProblemsRace

Moving Sum of Three

EasypandasPython

readings has a column value and at least 3 rows. Return a list with the sum of every three consecutive rows (rows 0 to 2, then 1 to 3, and so on). The list has len - 2 items.

Example 1

readings {"value":[1,2,3,4,5]}
returns [6.0,9.0,12.0]

1+2+3 = 6, 2+3+4 = 9, 3+4+5 = 12.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems