读取与生成新的excel文件:
import pandas as pd path = "score.xlsx" df = pd.read_excel(path) #读文件 df['主科总分'] = df['语文'] + df['数学'] +df['英语'] #修改文件内容:将主科、理科、文科的总分计算出来并插入到文件列的后面 df['理总'] = df['物理']+df['化学']+df['生物'] df['文综'] = df['政治']+df['历史']+df['地理'] df.to_excel("2.xlsx") #生成新的excel文件
标签:文件,主科,读取,df,excel,生成 From: https://www.cnblogs.com/scholarly/p/17001931.html