Python 如何将一个.agg的结果用作另一个中的参数?
我试图用一些基本的摘要函数在pandas dataframe中聚合一些数据,但是我需要一些这些摘要函数的函数 我目前正在做的是:Python 如何将一个.agg的结果用作另一个中的参数?,python,pandas,numpy,dataframe,Python,Pandas,Numpy,Dataframe,我试图用一些基本的摘要函数在pandas dataframe中聚合一些数据,但是我需要一些这些摘要函数的函数 我目前正在做的是: df_summary = df.groupby(['list', 'of', 'column', 'names'])['column to summarize'].agg(['sum', 'mean', 'some other functions']) df_summary["other_summary1"] = df_summary["mean"] * consta
df_summary = df.groupby(['list', 'of', 'column', 'names'])['column to summarize'].agg(['sum', 'mean', 'some other functions'])
df_summary["other_summary1"] = df_summary["mean"] * constant1 + constant2
df_summary["other_summary2"] = math.log(df_summary["other_summary1"])
我的直觉告诉我这不是惯用的方法,而且肯定有一种方法可以在.agg()
中对函数进行转换。有吗