本节要解决的问题
describe、groupby 与聚合。
核心要点
- describe 输出统计摘要
- groupby 按字段分组
- agg 做多种聚合
df.groupby("city")["score"].mean()分组后列会变成索引,reset_index 可还原。
本文根据 W3School Pandas 教程 的知识点重新整理、补充示例编写,非原文转载。
describe、groupby 与聚合。
describe、groupby 与聚合。
df.groupby("city")["score"].mean()分组后列会变成索引,reset_index 可还原。
本文根据 W3School Pandas 教程 的知识点重新整理、补充示例编写,非原文转载。