讓table中有相同ID的row可以成組
產生groupby物件
import numpy as np import pandas as pd data = {'Company': ['GooG', 'GooG', 'Att', 'Att'], 'Person': ['Sam', 'Mike', 'Ray', 'Neil'], 'Sales': [200, 100, 130, 500]} df = pd.DataFrame(data) byComp = df.GroupBy('Company')
對groupby物件使用aggregate function
byComp.mean() byComp.sum() byComp.std() byComp.count() byComp.min() byComp.describe() byComp.describe().transpose()
Last updated 4 years ago