Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -10082,11 +10082,7 @@ def update(

index_intersection = other.index.intersection(self.index)
if index_intersection.empty:
raise ValueError(
"Update not allowed when the index on `other` has no intersection "
"with this dataframe."
)

return
other = other.reindex(index_intersection)
this_data = self.loc[index_intersection]

Expand Down
11 changes: 6 additions & 5 deletions pandas/tests/frame/methods/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,13 @@ def test_update_raises_on_duplicate_argument_index(self):
with pytest.raises(ValueError, match="duplicate index"):
df.update(other)

def test_update_raises_without_intersection(self):
# GH#55509
df = DataFrame({"a": [1]}, index=[1])
def test_update_without_intersection(self):
# GH#63452
orig = DataFrame({"a": [1]}, index=[1])
df = orig.copy()
other = DataFrame({"a": [2]}, index=[2])
with pytest.raises(ValueError, match="no intersection"):
df.update(other)
df.update(other)
tm.assert_frame_equal(df, orig)

def test_update_on_duplicate_frame_unique_argument_index(self):
# GH#55509
Expand Down
Loading