import pandas as pd
# 读取excel指定读取的引擎
data = pd.read_excel('model.xls',engine='xlrd')
# 获取准备做表头的行,并转化为列表
ar = data.iloc[2].to_list()
# 将表头设置为上面取出的列表
data.columns = ar
# 删除多余的多余的行,及表头行,避免数据干扰
data.drop([0,1,2],inplace=True)
# 统计行中数据出现的频率
counts = data['分组'].value_counts()
# 取出统计中某些数据出现的频率
group1 = counts.get('优')
group2 = counts.get('良')
print(group1,group2)
09-03
964
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-07
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-21
8253
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-19
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交