I have two dataframes with identical structures df
and df_a
. df_a
is a subset of df
that I need to reintegrate into df
. Essentially, df_a
has various rows (with varying indices) from df
that have been manipulated.
Below is an example of indices of each df
and df_a
. These both have the same column structure so all the columns are the same, it's only the rows and idex of the rows that differ.
>> df
index .. other_columns ..
0
1
2
3
. .
9999
10000
10001
[10001 rows x 20 columns]
>> df_a
index .. other_columns ..
5
12
105
712
. .
9824
9901
9997
[782 rows x 20 columns]
So, I want to overwrite only the rows in df
that have the indices of df_a
with the corresponding rows in df_a
. I checked out Replace rows in a Pandas df with rows from another df and replace rows in a pandas data frame but neither of those tell how to use the indices of another dataframe to replace the values in the rows.