Karthik_hari1
Karthik_hari1

Reputation: 19

How to combine the dataset in python as below requirement

I have a dataset for which I need to add two new columns to an existing dataframe at the end.

Sample Input Data

Need to add these two columns to the Sample Input Data

Upvotes: 0

Views: 42

Answers (1)

jezrael
jezrael

Reputation: 862841

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)

Upvotes: 1

Related Questions