Planet Python 中文 关注 LernerPython 博客,作者 Reuven Lerner:Pandas groupby:使用多个函数对多列进行聚合 Python Pandas 是否支持多数据列和多方法?是的!df.groupby('passenger_count')[['trip_distance', 'total_amount']].agg(['mean', 'std'])上述代码返回一个数据框。其 4 列具有一个 2 级多索引,其中均值/标准差位于内层。 LernerPython blog, from Reuven Lerner: Pandas groupby: Aggregating multiple columns with multiple functions lernerpython.com Planet Python 中文 RSS thenote.app