pandas.DataFrame.value_counts

一、用法

Return a Series containing counts of unique rows in the DataFrame.

二、代码实现

import pandas as pd
df = pd.DataFrame({'A':[1,2,2]})
df
pandas.DataFrame.value_counts_第1张图片
df.value_counts()
df.value_counts(normalize=True)
# normalize : bool, default False
# Return proportions rather than frequencies.

你可能感兴趣的:(Python,pandas,python)