-1

I have a dataset like

acc_x 3216542
acc_y 564151
acc_z 4856454
gyr_x 515164
gyr_y 521561
gyr_z 181531

i want to get the average and standard variance of all acc_x,acc_y,acc_z and so on. i tried first to sort them and then manually select all the acc_x data to calculate the mean and SD. Is there an easier way to do this? I can use R or python or excel. Thanks in advance.

Samiur Rahman
  • 63
  • 1
  • 6
  • For R, the best answer is here: https://stackoverflow.com/questions/3505701/grouping-functions-tapply-by-aggregate-and-the-apply-family – Jason Feb 04 '20 at 11:18

2 Answers2

0

You can use pandas groupby

 df = df.groupby('column_a')['column_b'].mean()
MPA
  • 1,011
  • 7
  • 22
0

With R:

library(dplyr)

result = df %>% group_by(acc_name_column) %>% summarize(avg = mean(number_col), sd = sd(number_col))
monte
  • 1,482
  • 1
  • 10
  • 26