Closed
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