0

I have a data frame that looks like this:

Index    Measure    Tom    Harry    Mary
0        A          10     5        9
1        B          4      4        8
2        A          11     5        7
3        B          2      3        6
4        A          8      5        5
5        B          4      7        5
6        A          10     5        4
7        B          5      5        3

I basically need it to sum the values for each person for the rows where Measure = A. So for Tom, it would be 39, Harry would be 20 & Mary would be 25. Thanks in advance!

Melissa
  • 1
  • 1

1 Answers1

0

I figured it out! used pd.pivot_table(df, index=['Measure'], aggfunc=np.sum)

Melissa
  • 1
  • 1