import pandas as pd
students = pd.read_excel('D:/Temp/Students.xlsx',index_col='ID')
temp = students[['Test_1','Test_2','Test_3']]
row_sum = temp.sum(axis=1)
row_mean = temp.mean(axis=1)
students['Total'] = row_sum
students['Average'] = row_mean
col_mean=students[['Test_1','Test_2','Test_3','Total','Average']].mean() #python没有Aver 只有mean
col_mean['Name']='Sumary'
students = students.append(col_mean,ignore_index = True) #忽略索引
print(students)