Skip to content
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

REGR: Index.union loses python string dtype #54778

Merged
merged 2 commits into from
Aug 28, 2023
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Aug 27, 2023

cc @mroeschke

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@lithomas1 lithomas1 added this to the 2.1 milestone Aug 27, 2023
@phofl phofl added the Index Related to the Index class or subclasses label Aug 28, 2023
@phofl phofl mentioned this pull request Aug 28, 2023
@@ -5194,7 +5194,7 @@ def _from_join_target(self, result: np.ndarray) -> ArrayLike:
"""
if isinstance(self.values, BaseMaskedArray):
return type(self.values)(result, np.zeros(result.shape, dtype=np.bool_))
elif isinstance(self.values, ArrowExtensionArray):
elif isinstance(self.values, (ArrowExtensionArray, StringArray)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of interest, why can't this be done for all EAs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We enhanced this when we added _get_join_target. Previously we returned result unchanged, so not sure if this would potentially break stuff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok - this looks fine to be, but would prefer if someone more familiar with core/indexes could take a look too

@mroeschke mroeschke merged commit 5b07d7c into pandas-dev:main Aug 28, 2023
35 of 37 checks passed
@mroeschke
Copy link
Member

Thanks @phofl

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Aug 28, 2023
@phofl phofl deleted the 54745 branch August 28, 2023 15:17
mroeschke pushed a commit that referenced this pull request Aug 28, 2023
…ring dtype) (#54813)

Backport PR #54778: REGR: Index.union loses python string dtype

Co-authored-by: Patrick Hoefler <61934744+phofl@users.noreply.github.com>
mroeschke added a commit to mroeschke/pandas that referenced this pull request Sep 11, 2023
* REGR: Index.union loses python string dtype

* Update pandas/core/indexes/base.py

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pd.concat changes multiindex dtype of string to object
4 participants