统计数据表里某列的类别个数:value_counts()
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
df=pd.DataFrame('id'=[1,2,1,1,3,3,2,2])
df['id'].value_counts()
#或者比较复杂的写法
df.groupyby(['id'],as_index=False)['id'].agg({'统计':'count'}) #count是统计函数