FunctionRacerProblemsRace

Daily Change

EasypandasPython

prices has columns day and price (whole numbers). Return a list with how much the price changed since the previous row (this row minus the one before). The first row has no previous row, so its change is 0.

Example 1

prices {"day":[1,2,3],"price":[10,13,11]}
returns [0,3,-2]

0, +3, -2.

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