如果需要对多列操作,比如原始df格式是sid,math,Chinese,PE,表示一个学生的分数,比如求最高分,平均分,总分等操作 #由于一行中sid是学号,我们不需要选择该列求最大值,最小值,故在求最值前筛选出需要求最值的所有列 #原始数据:1,88,89,87 # 2,90,98,94 # 3,89,89,90 feature["max"]=feature[["math","Chinese","PE"]].max(axis=1) feature["mean"]=feature[["math","Chinese","PE"]].mean(axis=1) feature["sum"]=feature[["math","Chinese","PE"]].sum(axis=1)