-1

I have two dataframe table :

df1

id A
1  wer
3  dfg
5  dfg

df2

id A
2  fgv
4  sdfsdf

I want to join this to dataframe for one that will look like that:

df3

id A
1 wer
2 fgv
3 dfg

...

Anton vBR
  • 18,287
  • 5
  • 40
  • 46
doron
  • 9

2 Answers2

0
df3 = df1.merge(df2,how='outer',sort=True)
Gabi
  • 71
  • 5
0

There is concat method in pandas that you can use.

df3 = pd.concat([df1, df2])


You can sort index with -

df3 = df3.sort_index()


Or reset index like

df3 = df3.reset_index(drop=True)

I see you have ellipsis (...) at the end of your df3 dataframe if that means continuation in dataframe use above otherwise go for Jibril's answer

sarthak
  • 500
  • 9
  • 19