-1

I have two data-frames with same column names and similar data. How do I append/concatenate (row-wise) the second data-frame with the first?

For Example:

df1=

X1    X2    X3
1     a     x
2     b     y
3     c     z

and

df2=

X1    X2    X3
3     c     z
4     d     w

The result should be:

df_result=

X1    X2    X3
1     a     x
2     b     y
3     c     z
3     c     z
4     d     w

Where, X1, X2 and X3 are the column names.

Ashwin Geet D'Sa
  • 6,346
  • 2
  • 31
  • 59

1 Answers1

1

You could use append()

df_result = df1.append(df2)

or if you want a continuing index:

df_result = df1.append(df2, ignore_index=True)
LaurinO
  • 136
  • 6