Skip to content

Commit 6890117

Browse files
committed
Revert "Fixed metadata propagation in Dataframe.idxmax and Dataframe.idxmin #… (pandas-dev#47821)"
This reverts commit b0a51fe.
1 parent f11a5d2 commit 6890117

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11010,8 +11010,7 @@ def idxmin(
1101011010

1101111011
index = data._get_axis(axis)
1101211012
result = [index[i] if i >= 0 else np.nan for i in indices]
11013-
final_result = data._constructor_sliced(result, index=data._get_agg_axis(axis))
11014-
return final_result.__finalize__(self, method="idxmin")
11013+
return data._constructor_sliced(result, index=data._get_agg_axis(axis))
1101511014

1101611015
@doc(_shared_docs["idxmax"], numeric_only_default="False")
1101711016
def idxmax(
@@ -11036,8 +11035,7 @@ def idxmax(
1103611035

1103711036
index = data._get_axis(axis)
1103811037
result = [index[i] if i >= 0 else np.nan for i in indices]
11039-
final_result = data._constructor_sliced(result, index=data._get_agg_axis(axis))
11040-
return final_result.__finalize__(self, method="idxmax")
11038+
return data._constructor_sliced(result, index=data._get_agg_axis(axis))
1104111039

1104211040
def _get_agg_axis(self, axis_num: int) -> Index:
1104311041
"""

pandas/tests/generic/test_finalize.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,17 @@
226226
pytest.param(
227227
(pd.DataFrame, frame_data, operator.methodcaller("nunique")),
228228
),
229-
(pd.DataFrame, frame_data, operator.methodcaller("idxmin")),
230-
(pd.DataFrame, frame_data, operator.methodcaller("idxmax")),
231-
(pd.DataFrame, frame_data, operator.methodcaller("mode")),
229+
pytest.param(
230+
(pd.DataFrame, frame_data, operator.methodcaller("idxmin")),
231+
marks=not_implemented_mark,
232+
),
233+
pytest.param(
234+
(pd.DataFrame, frame_data, operator.methodcaller("idxmax")),
235+
marks=not_implemented_mark,
236+
),
237+
pytest.param(
238+
(pd.DataFrame, frame_data, operator.methodcaller("mode")),
239+
),
232240
pytest.param(
233241
(pd.Series, [0], operator.methodcaller("mode")),
234242
marks=not_implemented_mark,

0 commit comments

Comments
 (0)