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)