I have a dataset for which I need to add two new columns to an existing dataframe at the end.
CodePudding user response:
If ordering of rows of both DataFrames is same, use concat
with set default index values by drop=True
in DataFrame.reset_index
:
df = pd.concat([X_test.reset_index(drop=True), dfs], axis=1)