python

[python pandas] 그룹별 집계 - value_counts()

print(ResFrame["TypeName"].value_counts())

결과

type     count 
20484    5950
20483    2825
28674    2775
28672    2774
28673    2773
37       1465
25        168
1         148
16385      23
21         16
8193       14
20481       9
20482       3
5           3
20480       3
7           1
20485       1
Name: TypeName, dtype: int64

인덱스, 값 각기 따로 추출

print(RequestStastics.index)
print(RequestStastics.index.to_list())
print(RequestStastics.values.tolist())
['2021-11-26', '2021-11-17', '2021-11-15']
[3, 1, 1]