import pandas as pd
file_path = "C:/Users/zxzy/Desktop/22/"
df = pd.read_excel(file_path + '学生表.xlsx')
df1 = pd.read_excel(file_path + '成绩表.xlsx')
# 链接两个表 使用姓名匹配 空单元格替换成0
df2 = df.merge(df1, how = 'left', on = '姓名').fillna(0)
# 修改多列数据内容为指定类型
df2[['数学','语文']] = df2[['数学','语文']].astype(int)
# 获取指定列
df2.iloc[:,[0, 4, 2, 1, 3]]