@@ -2236,7 +2236,7 @@ def last_valid_index(self):
22362236 #----------------------------------------------------------------------
22372237 # Time series-oriented methods
22382238
2239- def shift (self , periods , offset = None , ** kwds ):
2239+ def shift (self , periods , freq = None , ** kwds ):
22402240 """
22412241 Shift the index of the Series by desired number of periods with an
22422242 optional time offset
@@ -2245,7 +2245,7 @@ def shift(self, periods, offset=None, **kwds):
22452245 ----------
22462246 periods : int
22472247 Number of periods to move, can be positive or negative
2248- offset : DateOffset, timedelta, or time rule string, optional
2248+ freq : DateOffset, timedelta, or time rule string, optional
22492249 Increment to use from datetools module or time rule (e.g. 'EOM')
22502250
22512251 Returns
@@ -2255,13 +2255,23 @@ def shift(self, periods, offset=None, **kwds):
22552255 if periods == 0 :
22562256 return self .copy ()
22572257
2258- offset = kwds . get ( 'timeRule' , offset )
2259- if isinstance ( offset , basestring ):
2260- # deprecated code path
2261- if isinstance (self . index , DateRange ):
2258+ if 'timeRule' in kwds or ' offset' in kwds :
2259+ offset = kwds . get ( 'offset' )
2260+ offset = kwds . get ( 'timeRule' , offset )
2261+ if isinstance (offset , basestring ):
22622262 offset = datetools .getOffset (offset )
2263- else :
2264- offset = datetools .to_offset (offset )
2263+ warn = True
2264+ else :
2265+ offset = freq
2266+ warn = False
2267+
2268+ if warn :
2269+ import warnings
2270+ warnings .warn ("'timeRule' and 'offset' parameters are deprecated,"
2271+ " please use 'freq' instead" , FutureWarning )
2272+
2273+ if isinstance (offset , basestring ):
2274+ offset = datetools .to_offset (offset )
22652275
22662276 if offset is None :
22672277 new_values = np .empty (len (self ), dtype = self .dtype )
@@ -2326,7 +2336,7 @@ def asfreq(self, freq, method=None):
23262336
23272337 Parameters
23282338 ----------
2329- offset : DateOffset object, or corresponding string
2339+ freq : DateOffset object, or corresponding string
23302340 DateOffset object or subclass (e.g. monthEnd)
23312341 method : {'backfill', 'pad', None}
23322342 Method to use for filling holes in new index
@@ -2336,8 +2346,6 @@ def asfreq(self, freq, method=None):
23362346 converted : TimeSeries
23372347 """
23382348
2339- # TODO: this uses deprecated API, add new method?
2340-
23412349 if isinstance (freq , datetools .DateOffset ):
23422350 dateRange = DateRange (self .index [0 ], self .index [- 1 ], offset = freq )
23432351 else :
0 commit comments