0

df1

    A   B   C   D
0  26   39  7   44

df2

    C   D   G   H
0   12  40  26  64

pd.concat([df1, df2],axis=0, ignore_index=True)

Please do not suggest joins as this column are dynamic desired output looks like this

     A   B   C   D   E   F   G   H
0   26  39   7   44 NaN NaN NaN NaN
1  NaN NaN  12   40  26  64 NaN NaN
Dani Mesejo
  • 61,499
  • 6
  • 49
  • 76

1 Answers1

1

I believe you need if there is more rows with same RangeIndex:

df = pd.concat([df1, df2]).sort_index().reset_index(drop=True)
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252