Skip to content

Commit f60b85d

Browse files
committed
call finalize in DataFrame.duplicated
1 parent a8e2f92 commit f60b85d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5285,7 +5285,8 @@ def f(vals):
52855285
labels, shape = map(list, zip(*map(f, vals)))
52865286

52875287
ids = get_group_index(labels, shape, sort=False, xnull=False)
5288-
return self._constructor_sliced(duplicated_int64(ids, keep), index=self.index)
5288+
result = self._constructor_sliced(duplicated_int64(ids, keep), index=self.index)
5289+
return result.__finalize__(self, method="duplicated")
52895290

52905291
# ----------------------------------------------------------------------
52915292
# Sorting

pandas/tests/generic/test_finalize.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,7 @@
115115
(pd.DataFrame, frame_data, operator.methodcaller("notnull")),
116116
(pd.DataFrame, frame_data, operator.methodcaller("dropna")),
117117
(pd.DataFrame, frame_data, operator.methodcaller("drop_duplicates")),
118-
pytest.param(
119-
(pd.DataFrame, frame_data, operator.methodcaller("duplicated")),
120-
marks=not_implemented_mark,
121-
),
118+
(pd.DataFrame, frame_data, operator.methodcaller("duplicated")),
122119
(pd.DataFrame, frame_data, operator.methodcaller("sort_values", by="A")),
123120
(pd.DataFrame, frame_data, operator.methodcaller("sort_index")),
124121
(pd.DataFrame, frame_data, operator.methodcaller("nlargest", 1, "A")),

0 commit comments

Comments
 (0)