I have DataFrame with clients' agreements like below:
rng = pd.date_range('2020-12-01', periods=5, freq='D')
df = pd.DataFrame({ "ID" : ["1", "2", "1", "2", "2"],
"value" : [100, 200, 300, 400, 500],
"status" : ["active", "finished", "active", "finished", "active"],
"Date": rng})
And I need to create new DataFrame with calculation based on above df:
- New1 = Value of the last agreement with status 'active'
- New2 = Value of the last agreement with status 'finished'
To be more precision I need to create df like below:
