I have two dataframes df1 and df2. df2 is the subset of df1
df1 = df1=[[0,1,0,0],
[1,2,0,0],
[2,0,0,0],
[2,4,0,0]]
df1 = pd.DataFrame(df1,columns=['A','B','C','D'])
>>> df1
A B C D
0 0 1 0 0
1 1 2 0 0
2 2 0 0 0
3 2 4 0 0
>>> df2
C D
2 1 3
3 2 4
I want to append the value of C and D from df2 to df1 based on index.
My expected output:
A B C D
0 0 1 0 0
1 1 2 0 0
2 2 0 1 3
3 2 4 2 4