import pandas import numpy page1=pandas.read_excel('成绩.xlsx',sheet_name='Sheet1') page2=pandas.read_excel('成绩.xlsx',sheet_name='Sheet2') page1.columns=['id','name','score1'] #上下连接表 students=pandas.concat([page1,page2],ignore_index=True) #追加一列 #students['ag']=numpy.repeat(25,len(students)) #把25这个数重复len(students)遍 students['age']=numpy.arange(0,len(students)) #生成0-len(students)的数 #删除一列 students.drop(columns=['age','score1'],inplace=True) #插入一列 students.insert(1,column='assert',value=numpy.repeat('ass',len(students))) #修改列名 students.rename(columns={'name':'Name','assert':'Assert'},inplace=True) #填充空值 students['id']=students['id'].astype(float) for i in range(3,10): students['id'].at[i]=numpy.nan #删除空值 students.dropna(inplace=True) #删除所有有空值的行 print(students)