-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
DeprecateFunctionality to remove in pandasFunctionality to remove in pandasDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
ser = pd.Series([1, 2, None, 4, 5, None])
ser.index = pd.MultiIndex.from_arrays([range(6), range(6, 12)])
>>> ser.unstack(fill_value="a")
6 7 8 9 10 11
0 1.0 a a a a a
1 a 2.0 a a a a
2 a a NaN a a a
3 a a a 4.0 a a
4 a a a a 5.0 a
5 a a a a a NaNIssue Description
ATM in unstack (specifically in _Unstacker.get_new_values) we pass a fill_value to maybe_promote which upcasts on fill_values that can't be held normally. We only do this for numpy dtypes, not EADtypes, which is a not-great inconsistency.
In the spirit of PDEP-6, should we consider deprecating this upcasting? Or like in #53802, maybe allow int->float?
Expected Behavior
NA
Installed Versions
Replace this line with the output of pd.show_versions()
Metadata
Metadata
Assignees
Labels
DeprecateFunctionality to remove in pandasFunctionality to remove in pandasDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode