I am trying to update a dataframe df_1 with values contained in a dataframe df_2.
df_1
ID B val val2
0 1 2 2
1 1 2 3
1 2 1 1
1 3 1 1
1 4 1 1
df_2
ID B val val2
0 1 1 3
1 1 3 3
1 3 3 3
The result I want is reported below in df_3:
df_3
ID B val val2
0 1 1 3
1 1 3 3
1 2 1 1
1 3 3 3
1 4 1 1
As you can the join columns are ID and B, and when there is a match in df_2 I substitute the values. Regarding values, df_2 contains the exact same columns of df_1.
There are two questions that mention that problem: Python pandas join on with overwrite and Python pandas - particular merge/replacement. These questions mention the exact same problem that I have, however when I try the solutions reported the join takes to much time, I have a huge dataset and I personally think that the mentioned solutions are suitable for small chunks of data. Furthermore, these questions are old, so I was wondering if there is any news in pandas that can speed-up this process.