diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 051ebfff47f83..34e8c969d1b75 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8285,7 +8285,8 @@ def combine( result[col] = arr # convert_objects just in case - return self._constructor(result, index=new_index, columns=new_columns) + frame_result = self._constructor(result, index=new_index, columns=new_columns) + return frame_result.__finalize__(self, method="combine") def combine_first(self, other: DataFrame) -> DataFrame: """ @@ -8360,7 +8361,7 @@ def combiner(x, y): if dtypes: combined = combined.astype(dtypes) - return combined + return combined.__finalize__(self, method="combine_first") def update( self, diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index 3c4ea5bd1fb2c..a76b6b94d719d 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -115,21 +115,15 @@ operator.methodcaller("add", pd.DataFrame(*frame_data)), ), # TODO: div, mul, etc. - pytest.param( - ( - pd.DataFrame, - frame_data, - operator.methodcaller("combine", pd.DataFrame(*frame_data), operator.add), - ), - marks=not_implemented_mark, + ( + pd.DataFrame, + frame_data, + operator.methodcaller("combine", pd.DataFrame(*frame_data), operator.add), ), - pytest.param( - ( - pd.DataFrame, - frame_data, - operator.methodcaller("combine_first", pd.DataFrame(*frame_data)), - ), - marks=not_implemented_mark, + ( + pd.DataFrame, + frame_data, + operator.methodcaller("combine_first", pd.DataFrame(*frame_data)), ), pytest.param( (