I have a dataset for which I need to add two new columns to an existing dataframe at the end.
Asked
Active
Viewed 38 times
0
-
Yuo can use a pandas.concat function to concatenate all together, but to be more precise you should explain what kind of machine learning process you are using, there is not enough information right now to give a precise answer – domiziano May 23 '22 at 08:06
1 Answers
1
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)

jezrael
- 822,522
- 95
- 1,334
- 1,252