当前位置:   article > 正文

python成绩统计_利用python进行学生成绩分析

某课程进行成绩分析,共n个班的成绩python

import os

import pandas as pd

import numpy as np

import openpyxl

from tkinter import *

from tkinter import filedialog

import tkinter.messagebox

from tkinter import ttk

def cjtj(df_xx,tj_bt,df,nj_ks,qz):

tj = pd.DataFrame({"单位":df_xx,

},

index = df_xx,

columns = tj_bt)

#计算学校人数

df_xxs=df.groupby('单位')['班级'].count()

tj['学生数']=df_xxs

for j in nj_ks.index.values:

tj[j+'人平']=df.groupby('单位')[j].mean()

tj[j+'及格']=df[df[j]>=nj_ks[j]*0.60].groupby('单位')['班级'].count()*100/tj['学生数']

tj[j+'优秀']=df[df[j]>=nj_ks[j]*0.80].groupby('单位')['班级'].count()*100/tj['学生数']

tj[j+'低分']=df[df[j]

tj = tj.fillna(0)

for j in nj_ks.index.values:

tj[j+'得分']=tj[j+'人平']*100*qz[0]/nj_ks[j]+tj[j+'及格']*qz[1]+tj[j+'优秀']*qz[2]-tj[j+'低分']*qz[3]

tj[j+'名次']=pd.Series(tj[j+'得分']).rank(ascending = False,method = 'min')

return tj

def main():

def selectExcelfile():

sfname = filedialog.askopenfilename(title='选择Excel文件', filetypes=[('Excel', '*.xlsx'), ('All Files', '*')])

if sfname:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/568552
推荐阅读
相关标签
  

闽ICP备14008679号