要点赞,要关注
需要用到pandas代码如下:
import pandas as pd data=pd.read_csv('scores.txt',sep='t') day_score=data['平时成绩'].tolist() over_score=data['期末成绩'].tolist() day_scored=[] over_scored=[] s_core_li=[] all1={} all1['学号']=data['学号'] for i in range(30): day_score1=day_score[i]*0.4 day_scored.append(day_score1) over_score1=over_score[i]*0.6 over_scored.append(over_score1) for j in range(30): s_core=over_scored[j]+day_scored[j] s_core_li.append(s_core) all1['总评成绩']=s_core_li df=pd.Dataframe(all1) df.to_csv('scored.txt', sep='t', index=False)结果图
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)