Skip to content

BUG: Fix concat dtype preservation through concat #61893

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

Closed

Conversation

adrienpacifico
Copy link
Contributor

@adrienpacifico adrienpacifico commented Jul 17, 2025


Expected behavior:

  • An empty categorical, and a categorical should concat as a categorical.

Linked issues:
#13524 see #13524 (comment)
#39443

#14177 (seems a dev call agreed on putting this as an option in concat)

#13767

@adrienpacifico adrienpacifico changed the title Concat categorical [BUF] Fix concat dtype preservation through concat Jul 17, 2025
@adrienpacifico adrienpacifico changed the title [BUF] Fix concat dtype preservation through concat [BUG] Fix concat dtype preservation through concat Jul 17, 2025
@adrienpacifico adrienpacifico changed the title [BUG] Fix concat dtype preservation through concat BUG: Fix concat dtype preservation through concat Jul 17, 2025
@jbrockmendel
Copy link
Member

As mentioned in #51362, this is not a bug, but we are willing to support this via a keyword in pd.concat.

I think there are also some older related issues this would close. Can you make sure those are listed in the OP.

@simonjayhawkins simonjayhawkins added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Categorical Categorical Data Type Bug labels Jul 22, 2025
@adrienpacifico
Copy link
Contributor Author

Closing this for now — I ran into more complexity than expected. Might revisit later with a cleaner approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pd.concat doesn't preserve categorical dtypes
4 participants