Skip to content Skip to sidebar Skip to footer

How To Use Join_axes In The Column-wise Axis Concatenation Using Pandas Dataframe?

Data set: df2 = pd.DataFrame({'A':[1, 2], 'B':[3, 4]}) df3 = pd.DataFrame({'A':[5, 6, 7], 'B':[8, 9, 10], 'C':[11, 12, 13]}) I am only able to use join_axes in the 'row-wise' conc

Solution 1:

I believe need set join_axes by columns of df2:

df = pd.concat([df2, df3], join_axes = [df2.columns])
print (df)
   A   B
0  1   3
1  2   4
0  5   8
1  6   9
2  7  10

Solution 2:

Maybe quicker:

df = df2.append(df3)
print(df)
   A   B
0  1   3
1  2   4
0  5   8
1  6   9
2  7  10

Post a Comment for "How To Use Join_axes In The Column-wise Axis Concatenation Using Pandas Dataframe?"