复制
收藏
提问
全网

import pandas as pd wb_physics = pd.read_excel(r'mark.xlsx') wb_python = pd.read_excel(r'mark.xlsx') wb_math = pd.read_excel(r'mark.xlsx') wb_english = pd.read_excel(r'mark.xlsx') print(wb_physics) df=pd.read_excel('D:\python\keshe\mark.xlsx') name_list = df['name'].values.tolist() physics_list = df['physics'].values.tolist() math_list = df['math'].values.tolist() english_list = df['english'].values.tolist() python_list = df['python'].values.tolist() print(name_list) subject=input("输入课程") if subject=='math': print(math_list) print(max(math_list)) print(min(math_list)) print(sum(math_list)/50) elif subject=='english': print(english_list) print(max(english_list)) print(min(english_list)) print(sum(english_list)/50) elif subject=='python': print(python_list) print(max(python_list)) print(min(python_list)) print(sum(python_list)/50) elif subject=='physics': print(physics_list) print(max(physics_list)) print(min(physics_list)) print(sum(physics_list)/50) import matplotlib.pyplot as plt import numpy as np plt.rcParams ['font.sans-serif'] =['SimHei'] plt.rcParams ['axes.unicode_minus'] =False if subject=='math': def func_math(): a,b,c,d,e=0,0,0,0,0 for i in math_list: if i >= 90 : a=a+1 elif i >= 80 and i < 90: b=b+1 elif i >= 70 and i <80: c=c+1 elif i >= 60 and i < 70: d=d+1 else: e=e+1 return a,b,c,d,e if subject=='english': def func_english(): a,b,c,d,e=0,0,0,0,0 for i in english_list: if i >= 90 : a=a+1 elif i >= 80 and i < 90: b=b+1 elif i >= 70 and i <80: c=c+1 elif i >= 60 and i < 70: d=d+1 else: e=e+1 return a,b,c,d,e if subject=='python': def func_python(): a,b,c,d,e=0,0,0,0,0 for i in python_list: if i >= 90 : a=a+1 elif i >= 80 and i < 90: b=b+1 elif i >= 70 and i <80: c=c+1 elif i >= 60 and i < 70: d=d+1 else: e=e+1 return a,b,c,d,e if subject=='physics': def func_physics(): a,b,c,d,e=0,0,0,0,0 for i in physics_list: if i >= 90 : a=a+1 elif i >= 80 and i < 90: b=b+1 elif i >= 70 and i <80: c=c+1 elif i >= 60 and i < 70: d=d+1 else: e=e+1 return a,b,c,d,e if subject=='math': a1, b1,c1,d1, e1=func_math() elif subject=='english ' : a1, b1,c1,d1, e1=func_english() if subject=='python': a1, b1,c1,d1, e1=func_python() if subject=='physics': a1, b1,c1,d1, e1=func_physics() x=[ '>90' , '80~89' , '70~79' , '60~69' , '60以下'] y=[ a1,b1,c1,d1,e1] ax = plt.axes() plt.grid(axis="y",c= '#d2c9eb', linestyle = '--' , zorder=0) for i in range(len(y)): plt.text(i,y[i] + 0.7, "%s"%y[i],va='center') plt.bar(x,y, label="Attention weights", color="#7e728c" ,edgecolor='black',linewidth = 2, zorder=10) plt.ylim(0,40) plt.title("{}成绩分析".format(subject)) plt.xlabel("分数段") plt.ylabel("人数") plt.show() labels = x explode=[0.1,0,0,0,0.1] plt.pie(y,explode=explode,labels=labels,autopct='%1.1f%%',shadow=True, startangle=160) plt.legend() plt.title("{}成绩分析".format(subject)) plt.show()

1b69d641a
3个月前
全网
文档
学术
百科
知识库
时间不限
自动
回答专业
更简洁一些
您已终止本次搜索,可编辑问题后重新提问。
在线客服