There is such a watch :

Sum up , Averaging :
import pandas as pdstudent = pd.read_excel("C:/Users/Administrator/Desktop/Students.xlsx",index_col="ID")temp = student[["Test_1","Test_2","Test_3"]]student["total"] = temp.sum(axis=1)#axis 0 Column ,1 For the line student["avg"] = temp.mean(axis=1)print(student)
Calculate the average score of each subject , Sum up :
col_mean = student[["Test_1","Test_2","Test_3","total","avg"]].mean()col_mean["Name"]="Summary"student = student.append(col_mean,ignore_index=True)student[["Test_1","Test_2","Test_3","total","avg"]] = student[["Test_1","Test_2","Test_3","total","avg"]].astype(int)print(student)
append You can add a line directly
DataFrame.append(other, ignore_index=False, verify_integrity=False, sort=None)
Refer to the official website