分组级运算和转换 假设要添加一列的各索引分组平均值 第一种方法 import pandas as pd from pandas import Series import numpy as np df = pd.DataFrame([[-2.04708,1.393406,'a','one'], [0.478943,0.092908,'a','two'], [-0.519439,0.281746,'b','one'], [-0.555730,0.769023,'b','two'], [1.96578…