赞
踩
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:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。