1、问题描述
使用python自带的collections喜爱的Counter函数能够清点数组中每个类别及对应的个数
2、例子
df = pd.read_excel('2.xlsx')y = df.iloc[:,-1]print(Counter(y))#Counter({0: 1865, 1: 99})#
如果觉得《python collections.Counter》对你有帮助,请点赞、收藏,并留下你的观点哦!
时间:2022-03-27 07:00:04
使用python自带的collections喜爱的Counter函数能够清点数组中每个类别及对应的个数
df = pd.read_excel('2.xlsx')y = df.iloc[:,-1]print(Counter(y))#Counter({0: 1865, 1: 99})#
如果觉得《python collections.Counter》对你有帮助,请点赞、收藏,并留下你的观点哦!
Python collections.Counter()用法
2022-01-10
【Python】详解 collections.Counter
2019-02-01
【python】collections.Counter()函数
2018-10-31