Say I want to compute the relative complement df2 - df1
between two MultiIndex dataframes. Assuming that they have the same indexing schema, based on what I saw in this answer from Andy Hayden, I could do the following:
diff_indices = df2.index - df1.index
And then either:
df2.reindex(diff_indices, inplace=True)
or
df2 = df2.loc[diff_indices]
What would be the difference between 1. and 2. above? What is the difference between df.reindex
and df.loc
?