Python 数据帧分组和标准差

Python 数据帧分组和标准差,python,pandas,Python,Pandas,给定以下格式的数据帧: GroupNo | at1 | at2 | at3 | at4 1 | 0.02|1.12 | 1.88 | 3.2 1 | 6.11|1.13 | 0.88 | 5.2 4 | 2.02|1.16 | 2.88 | 0.2 3 | 0.20|0.12 | 1.48 | 1.25 2 | 0.02|1.12 | 1.88 | 1.4 3 | 3.02|1.12 | 1.98 | 2.

给定以下格式的数据帧:

GroupNo | at1 | at2 | at3   | at4 
1       | 0.02|1.12 | 1.88  | 3.2
1       | 6.11|1.13 | 0.88  | 5.2
4       | 2.02|1.16 | 2.88  | 0.2
3       | 0.20|0.12 | 1.48  | 1.25
2       | 0.02|1.12 | 1.88  | 1.4
3       | 3.02|1.12 | 1.98  | 2.2
3       | 0.40|0.18 | 1.48  | 1.25
我怎样才能找到每组的平均标准偏差

例如,按groupNo分组,找到该组号中属性的标准偏差,找到它们的平均值标准偏差

任何帮助都会很好, 我想你需要:

或者可能需要:

print (df.groupby('GroupNo').mean().std(axis=1))
GroupNo
1    1.453848
2    0.788480
3    0.535371
4    1.149420
dtype: float64

谢谢,这会包括std()计算中的组号吗?不,您可以通过
print(df.groupby('GroupNo')['at1'、'at2'、'at3'、'at4'].std())
groupby('GroupNo').std().mean(axis=1)和df.groupby('GroupNo').mean().std(axis=1)之间的区别是什么?groupby.std.mean表示平均值的标准偏差,groupby.mean.st表示平均值的标准偏差?
print (df.groupby('GroupNo').mean().std(axis=1))
GroupNo
1    1.453848
2    0.788480
3    0.535371
4    1.149420
dtype: float64