I have a dataframe that looks like this:
Index_1 Index_2 Week_1 Week_2 Week_3
0 A 1 2 3
B 2 3 4
1 A 4 5 6
B 7 8 9
For each unique value in Index_1, I want to add a row to Index_2, called "Diff" that will calculate the difference between A and B in Week_1, Week_2, Week_3, and so on.
See below for what I'm hoping it'll look like:
Index_1 Index_2 Week_1 Week_2 Week_3
0 A 1 2 3
B 2 3 4
Diff 1 1 1
1 A 4 5 6
B 7 8 9
Diff 3 3 3