Skip to content

CLN: concat union_indexes now respecting sort keyword #47588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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(
Expand Down