data是一个dataframe
#data["x1"]=data[["a","b"]].apply(lambda x:x["a"]+x["b"],axis=1)
data["x1"]=data.apply(lambda x:x["a"]+x["b"],axis=1)
一定要加axis=1,指定列,否则会报错!!!
参考:https://blog.csdn.net/wolf1132/article/details/90543863?utm_medium=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.not_use_machine_learn_pai&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.not_use_machine_learn_pai