Series.unique()
返回Series
对象中唯一值的NumPy array
pd.Series([2, 1, 3, 3], name='A').unique()
#array([2, 1, 3])
Series.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True)
返回一个Series,记录Series
对象中唯一值出现的次数。
index = pd.Index([3, 1, 2, 3, 4, np.nan])
index.value_counts()
#3.0 2
#4.0 1
#2.0 1
#1.0 1
#dtype: int64