0

I was try to get a average columns for all the std columns

enter image description here

I want to add one more column to calculate the average value from Std_4-Std_10 values. Not sure should I use groupby or pivot. Thanks

qing zhangqing
  • 381
  • 1
  • 4
  • 13

1 Answers1

0

Use:

df.filter(like='Std').mean(1)

To add it back into your dataframe, use:

df['mean_Std'] = df.filter(like='Std').mean(1)
sacuL
  • 49,704
  • 8
  • 81
  • 106