diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 82ae93ad31763..8dc838a5d61a5 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -9523,7 +9523,6 @@ def _append( verify_integrity: bool = False, sort: bool = False, ) -> DataFrame: - combined_columns = None if isinstance(other, (Series, dict)): if isinstance(other, dict): if not ignore_index: @@ -9536,8 +9535,6 @@ def _append( ) index = Index([other.name], name=self.index.name) - idx_diff = other.index.difference(self.columns) - combined_columns = self.columns.append(idx_diff) row_df = other.to_frame().T # infer_objects is needed for # test_append_empty_frame_to_series_with_dateutil_tz @@ -9563,16 +9560,6 @@ def _append( verify_integrity=verify_integrity, sort=sort, ) - if ( - combined_columns is not None - and not sort - and not combined_columns.equals(result.columns) - ): - # TODO: reindexing here is a kludge bc union_indexes does not - # pass sort to index.union, xref #43375 - # combined_columns.equals check is necessary for preserving dtype - # in test_crosstab_normalize - result = result.reindex(combined_columns, axis=1) return result.__finalize__(self, method="append") def join(