File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ Default dtype of empty :class:`pandas.Series`
558558^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
559559
560560Initialising an empty :class: `pandas.Series ` without specifying a dtype will raise a `DeprecationWarning ` now
561- (:issue: `17261 `). The default dtype will change from ``float64 `` to ``object `` in future releases so that it is
561+ (:issue: `17261 `). The default dtype will change from ``float64 `` to ``Object `` in future releases so that it is
562562consistent with the behaviour of :class: `DataFrame ` and :class: `Index `.
563563
564564*pandas 1.0.0 *
Original file line number Diff line number Diff line change 2424from pandas .core .dtypes .missing import isna
2525
2626from pandas .core import ops
27- from pandas .core .algorithms import _factorize_array , unique
27+ from pandas .core .algorithms import _factorize_array , diff , unique
2828from pandas .core .missing import backfill_1d , pad_1d
2929from pandas .core .sorting import nargsort
3030
@@ -516,6 +516,9 @@ def argsort(
516516 result = nargsort (self , kind = kind , ascending = ascending , na_position = "last" )
517517 return result
518518
519+ def diff (self , n_periods ):
520+ return type (self )._from_sequence (diff (self , n_periods ), dtype = self .dtype )
521+
519522 def fillna (self , value = None , method = None , limit = None ):
520523 """
521524 Fill NA/NaN values using the specified method.
Original file line number Diff line number Diff line change @@ -2316,13 +2316,11 @@ def diff(self, periods=1) -> "Series":
23162316 5 NaN
23172317 dtype: float64
23182318 """
2319- result = algorithms .diff (com .values_from_object (self ), periods )
23202319 if is_extension_array_dtype (self .dtype ) and not is_datetime64tz_dtype (
23212320 self .dtype
23222321 ):
2323- return self ._constructor (
2324- result , index = self .index , dtype = self .dtype
2325- ).__finalize__ (self )
2322+ return self .values .diff (n_periods = periods )
2323+ result = algorithms .diff (com .values_from_object (self ), periods )
23262324 return self ._constructor (result , index = self .index ).__finalize__ (self )
23272325
23282326 def autocorr (self , lag = 1 ) -> float :
You can’t perform that action at this time.
0 commit comments