import pandas as pd a=['优秀','良好','合格','不合格'] b=['90分','80分','60分','0分'] f=pd.read_excel("C:\\Users\\Administrator\\Desktop\\Python成绩登记信计.xlsx") for index in range(len(f.index)): for i in range(4): f.iloc[index]=f.iloc[index].replace(a[i],b[i]) f.to_csv("C:\\Users\\Administrator\\Desktop\\Python成绩登记信计.csv",index=False,header=1)
前:
后: