0

for example two dataframe

     a              b    c                                
0    1         0    2    7
1    2         1    3    6
2    3         2    4    5 

i want to get

     a     b    c                                
0    1     2    7   
1    2     3    6    
2    3     4    5  

if dataframe has to mant colums

Seems to be somewhat difficult

Oane
  • 49
  • 4

1 Answers1

2

You can use pd.concat() with axis=1, see docs

df_1 = pd.DataFrame([
  [1],
  [2],
  [3],
], columns=["a"])

df_2 = pd.DataFrame([
  [2, 7],
  [3, 6],
  [4, 5],
], columns=["b", "c"])

df_3 = pd.concat([df_1, df_2], axis=1)

print(df_3)

Result:

   a  b  c
0  1  2  7
1  2  3  6
2  3  4  5
pdpino
  • 444
  • 4
  • 13