I have two separate dataframes, df1
and df2
. I want to be able to create a new dataframe based on a row from df1
and row from df2
.
I need to be able to create a new df, based on row index [1] of df1 & row index [2] of df2
Below is df1
df1
A B C
0 1.57 4.40 6.00
1 1.73 3.95 5.00
2 1.26 6.60 12.00
df2
df2
D E F
0 1.57 4.48 6.25
1 1.27 6.73 11.88
2 1.74 3.99 5.11
Expected New_Df
A B C D E F
0 1.73 3.95 5.00 1.74 3.99 5.11
CodePudding user response:
You can try pd.concat
out = pd.concat([df1.iloc[1], df2.iloc[2]], axis=0).to_frame().T
print(out)
A B C D E F
0 1.73 3.95 5.0 1.74 3.99 5.11