# 通过数据框列向(左右)合并 a = pd.DataFrame(X_train) b = pd.DataFrame(y_train) # 合并数据框(合并前需要将数据设置成DataFrame格式), 其中,如果axis=1,ignore_index将改变的是列上的索引(属性名) print(pd.concat([a,b], axis=1, ignore_index=False)) `