API: expected result of concat of SparseArray with Categorical? #34459
Labels
API - Consistency
Internal Consistency of API/Behavior
Categorical
Categorical Data Type
Enhancement
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Sparse
Sparse Data Type
xref #34338
The current behaviour when Sparse and Categorical are concatenated, is that for both the "dense" values are used (for sparse the densified values, for categorical the non-categorical version of the values).
For example, Sparse[int] with Categorical[int] results in a plain
int
series:An alternative could also be to preserve the sparseness in the result, which is what happens when concatting with a plain int series (not categorical):
(alternatively, you could maybe also say that concatting with categorical should never give a numerical result, but rather object dtype or so)
The text was updated successfully, but these errors were encountered: