-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
DatetimeDatetime data dtypeDatetime data dtypeEnhancementMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explodegood first issue
Milestone
Description
Feature Request
At the moment, the Series/DataFrame shift
methods always fill with nans, which causes an upcast for boolean/integer types. In cases where there is an appropriate non-nan fill value, it would be useful to provide this value in shift
, rather than having to correctly downcast the result. This would presumably also be more efficient than .shift().fillna()
in those cases where no upcast is required.
Example Code
>>> pd.Series([True]).shift(fill_value=False)
0 False
dtype: bool
Metadata
Metadata
Assignees
Labels
DatetimeDatetime data dtypeDatetime data dtypeEnhancementMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explodegood first issue