Skip to content

Commit 36c7a45

Browse files
phoflyehoshuadimarsky
authored andcommitted
CLN: concat union_indexes now respecting sort keyword (pandas-dev#47588)
1 parent 92f0e02 commit 36c7a45

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

pandas/core/frame.py

-13
Original file line numberDiff line numberDiff line change
@@ -9523,7 +9523,6 @@ def _append(
95239523
verify_integrity: bool = False,
95249524
sort: bool = False,
95259525
) -> DataFrame:
9526-
combined_columns = None
95279526
if isinstance(other, (Series, dict)):
95289527
if isinstance(other, dict):
95299528
if not ignore_index:
@@ -9536,8 +9535,6 @@ def _append(
95369535
)
95379536

95389537
index = Index([other.name], name=self.index.name)
9539-
idx_diff = other.index.difference(self.columns)
9540-
combined_columns = self.columns.append(idx_diff)
95419538
row_df = other.to_frame().T
95429539
# infer_objects is needed for
95439540
# test_append_empty_frame_to_series_with_dateutil_tz
@@ -9563,16 +9560,6 @@ def _append(
95639560
verify_integrity=verify_integrity,
95649561
sort=sort,
95659562
)
9566-
if (
9567-
combined_columns is not None
9568-
and not sort
9569-
and not combined_columns.equals(result.columns)
9570-
):
9571-
# TODO: reindexing here is a kludge bc union_indexes does not
9572-
# pass sort to index.union, xref #43375
9573-
# combined_columns.equals check is necessary for preserving dtype
9574-
# in test_crosstab_normalize
9575-
result = result.reindex(combined_columns, axis=1)
95769563
return result.__finalize__(self, method="append")
95779564

95789565
def join(

0 commit comments

Comments
 (0)