pandas 之 groupby 聚合函数
import numpy as np import pandas as pd 聚合函数 Aggregations refer to any data transformation that produces scalar values from arrays(输入是数组, 输出是标量值). The preceding examples have used several of them, including mean, count, min, and sum You may wonder what is going on when you invoke mean() on a GroupBy object, Many common aggregations such as those found in Table 10-1, have optimized implementations. However, you are not limited to only this set of methods. count sum mean median std, var min, max prod first, last You can use aggregations of your own devising and additionally call any method that