Skip to content
Prev Previous commit
Next Next commit
No longer reindexing columns, skipping non-matching columns
  • Loading branch information
wxing11 committed Nov 3, 2022
commit c63d1cc55d9984e16f73e8db94c4ddbbda8b3721
9 changes: 5 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -8190,15 +8190,16 @@ def update(
if not isinstance(other, DataFrame):
other = DataFrame(other)

other = other.reindex_like(self)
# reindex rows, non-matching columns get skipped
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need this comment

other = other.reindex(self.index)

for col in self.columns:
if col not in other.columns:
continue

this = self[col]._values
that = other[col]._values

if all(isna(that)):
continue

if filter_func is not None:
with np.errstate(all="ignore"):
mask = ~filter_func(this) | isna(that)
Expand Down