一、准备工作
pip install pandas
pip install openpyxl
pip install pyinstaller
数据表格:
数据表下载
二、执行写入操作
import pandas as pd
# pyinstaller --onefile attendance_records_score.py # 打包
# 读取源Excel文件(假设源表有列'A_column'和'B_column')
df_source = pd.read_excel('total_score.xlsx')
# 创建一个新的DataFrame用于写入目标表(假设目标表需要有列'X_column'和'Y_column')
df_target = pd.DataFrame({'stu_number': df_source['序号'],'stu_id': df_source['学号'],'stu_name': df_source['姓名'],'stu_class': df_source['班级'],'one_score': df_source['k1'],'two_score': df_source['k2'],'three_sroce': df_source['k3'],'four_score': df_source['k4'],'five_score': df_source['k5']
})
# 将数据写入目标Excel文件
df_target.to_excel('total_score1.xlsx', index=False)
print("create attendance_records_score finish")
三、打包命令
pyinstaller --onefile attendance_records_score.py
四、脚本制作
@echo off
start /B attendance_records_score.exe