I'd like to see if there's a way to calculate something like the following on Python, is it possible?
ID Rotation Starting_degree Current_degree
1 40 360 320
1 55 320 265
2 70 360 290
1 15 265 250
2 20 290 270
3 30 360 330
3 60 330 270
1 25 250 225
In general my code is df['current_degree'] = df.apply(lambda row: row.starting_degree - row.rotation, axis = 1)
, but I'd like the starting degree figure to change based on ID and any previous calculations.
With each new ID the starting degree resets to 360.