ChrisLK
ChrisLK

Reputation: 1

Finding the period-over-period difference across entire dataset

I'm working with a quarterly dataset where I want to return the difference between each period.

idx     items            period        metric 1 metric 2
0   Item A          2022-12-31               68      100
1   Item A          2023-06-30               72       99
2   Item A          2023-09-30               88       98
3   Item B          2022-12-31               13      100
4   Item B          2023-06-30               68       90
5   Item B          2023-09-30               50       80    

i have about 30 metrics, where i want to return the change for all items, period over period. based on the above, i'd like the output to bring back the change for item A for all periods, for every metric.

Any suggestions on the best approach would be much appreciated.

I've tried using the df.diff()

Upvotes: 0

Views: 15

Answers (0)

Related Questions