@@ -3806,15 +3806,15 @@ def mask(self, cond, other=np.nan, inplace=False, axis=None, level=None,
3806
3806
shifted : %(klass)s
3807
3807
""" )
3808
3808
@Appender (_shared_docs ['shift' ] % _shared_doc_kwargs )
3809
- def shift (self , periods = 1 , freq = None , axis = 0 , ** kwargs ):
3809
+ def shift (self , periods = 1 , freq = None , axis = 0 ):
3810
3810
if periods == 0 :
3811
3811
return self
3812
3812
3813
3813
block_axis = self ._get_block_manager_axis (axis )
3814
- if freq is None and not len ( kwargs ) :
3814
+ if freq is None :
3815
3815
new_data = self ._data .shift (periods = periods , axis = block_axis )
3816
3816
else :
3817
- return self .tshift (periods , freq , ** kwargs )
3817
+ return self .tshift (periods , freq )
3818
3818
3819
3819
return self ._constructor (new_data ).__finalize__ (self )
3820
3820
@@ -3854,7 +3854,7 @@ def slice_shift(self, periods=1, axis=0):
3854
3854
3855
3855
return new_obj .__finalize__ (self )
3856
3856
3857
- def tshift (self , periods = 1 , freq = None , axis = 0 , ** kwargs ):
3857
+ def tshift (self , periods = 1 , freq = None , axis = 0 ):
3858
3858
"""
3859
3859
Shift the time index, using the index's frequency if available
3860
3860
@@ -3877,7 +3877,6 @@ def tshift(self, periods=1, freq=None, axis=0, **kwargs):
3877
3877
-------
3878
3878
shifted : NDFrame
3879
3879
"""
3880
- from pandas .core .datetools import _resolve_offset
3881
3880
3882
3881
index = self ._get_axis (axis )
3883
3882
if freq is None :
@@ -3893,24 +3892,22 @@ def tshift(self, periods=1, freq=None, axis=0, **kwargs):
3893
3892
if periods == 0 :
3894
3893
return self
3895
3894
3896
- offset = _resolve_offset (freq , kwargs )
3897
-
3898
- if isinstance (offset , string_types ):
3899
- offset = datetools .to_offset (offset )
3895
+ if isinstance (freq , string_types ):
3896
+ freq = datetools .to_offset (freq )
3900
3897
3901
3898
block_axis = self ._get_block_manager_axis (axis )
3902
3899
if isinstance (index , PeriodIndex ):
3903
- orig_offset = datetools .to_offset (index .freq )
3904
- if offset == orig_offset :
3900
+ orig_freq = datetools .to_offset (index .freq )
3901
+ if freq == orig_freq :
3905
3902
new_data = self ._data .copy ()
3906
3903
new_data .axes [block_axis ] = index .shift (periods )
3907
3904
else :
3908
3905
msg = ('Given freq %s does not match PeriodIndex freq %s' %
3909
- (offset .rule_code , orig_offset .rule_code ))
3906
+ (freq .rule_code , orig_freq .rule_code ))
3910
3907
raise ValueError (msg )
3911
3908
else :
3912
3909
new_data = self ._data .copy ()
3913
- new_data .axes [block_axis ] = index .shift (periods , offset )
3910
+ new_data .axes [block_axis ] = index .shift (periods , freq )
3914
3911
3915
3912
return self ._constructor (new_data ).__finalize__ (self )
3916
3913
0 commit comments