diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 47203fbf315e59..e62f9fa8076d89 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -11010,8 +11010,7 @@ def idxmin( index = data._get_axis(axis) result = [index[i] if i >= 0 else np.nan for i in indices] - final_result = data._constructor_sliced(result, index=data._get_agg_axis(axis)) - return final_result.__finalize__(self, method="idxmin") + return data._constructor_sliced(result, index=data._get_agg_axis(axis)) @doc(_shared_docs["idxmax"], numeric_only_default="False") def idxmax( @@ -11036,8 +11035,7 @@ def idxmax( index = data._get_axis(axis) result = [index[i] if i >= 0 else np.nan for i in indices] - final_result = data._constructor_sliced(result, index=data._get_agg_axis(axis)) - return final_result.__finalize__(self, method="idxmax") + return data._constructor_sliced(result, index=data._get_agg_axis(axis)) def _get_agg_axis(self, axis_num: int) -> Index: """ diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index dddab05af7341e..6901d415a5ae73 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -226,9 +226,17 @@ pytest.param( (pd.DataFrame, frame_data, operator.methodcaller("nunique")), ), - (pd.DataFrame, frame_data, operator.methodcaller("idxmin")), - (pd.DataFrame, frame_data, operator.methodcaller("idxmax")), - (pd.DataFrame, frame_data, operator.methodcaller("mode")), + pytest.param( + (pd.DataFrame, frame_data, operator.methodcaller("idxmin")), + marks=not_implemented_mark, + ), + pytest.param( + (pd.DataFrame, frame_data, operator.methodcaller("idxmax")), + marks=not_implemented_mark, + ), + pytest.param( + (pd.DataFrame, frame_data, operator.methodcaller("mode")), + ), pytest.param( (pd.Series, [0], operator.methodcaller("mode")), marks=not_implemented_mark,