I want to combine 2 seperate data frame of the following shape in Python Pandas:
Df1=
A B
1 1 2
2 3 4
3 5 6
Df2 =
C D
1 a b
2 c d
3 e f
I want to have as follows:
df =
A B C D
1 1 2 a b
2 3 4 c d
3 5 6 e f
I am using the following code:
dat = df1.join(df2)
But problem is that, In my actual data frame there are more than 2 Million rows and for that it takes too long time and consumes huge memory.
Is there any way to do it faster and memory efficient?
Thank you in advance for helping.