Here's my data:
| id | date | period | score |
|---|---|---|---|
| 1 | 2015-01-01 | start | 5 |
| 1 | 2015-01-15 | end | 10 |
| 2 | 2015-01-01 | start | 2 |
| 2 | 2015-01-07 | mid_1 | 7 |
| 2 | 2015-01-14 | end | 10 |
These are records of scores over time. I have encoded the period column so its easy for you to interpret.
How can I find difference or percent change in scores from start to end?
If I do pd.groupby, I could find the min or max date, but how would I match that to the score on min or max date?
I don't care if the calculation uses date or period, I just need to figure out how to match.
I want data that looks like this:
| id | change_in_score_start_to_end |
|---|---|
| 1 | 100% |
| 2 | 400% |