Skip to content

Commit 459e649

Browse files
committed
BUG: Allow empty interesection in DataFrame.update
1 parent 3aad0bf commit 459e649

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

pandas/core/frame.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10081,12 +10081,6 @@ def update(
1008110081
raise ValueError("Update not allowed with duplicate indexes on other.")
1008210082

1008310083
index_intersection = other.index.intersection(self.index)
10084-
if index_intersection.empty:
10085-
raise ValueError(
10086-
"Update not allowed when the index on `other` has no intersection "
10087-
"with this dataframe."
10088-
)
10089-
1009010084
other = other.reindex(index_intersection)
1009110085
this_data = self.loc[index_intersection]
1009210086

pandas/tests/frame/methods/test_update.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,6 @@ def test_update_raises_on_duplicate_argument_index(self):
215215
with pytest.raises(ValueError, match="duplicate index"):
216216
df.update(other)
217217

218-
def test_update_raises_without_intersection(self):
219-
# GH#55509
220-
df = DataFrame({"a": [1]}, index=[1])
221-
other = DataFrame({"a": [2]}, index=[2])
222-
with pytest.raises(ValueError, match="no intersection"):
223-
df.update(other)
224-
225218
def test_update_on_duplicate_frame_unique_argument_index(self):
226219
# GH#55509
227220
df = DataFrame({"a": [1, 1, 1]}, index=[1, 1, 2], dtype=np.dtype("intc"))

0 commit comments

Comments
 (0)