def tshift(self, periods=<NUM_LIT:1>, freq=None, axis=<NUM_LIT:0>):
index = self._get_axis(axis)<EOL>if freq is None:<EOL><INDENT>freq = getattr(index, '<STR_LIT>', None)<EOL><DEDENT>if freq is None:<EOL><INDENT>freq = getattr(index, '<STR_LIT>', None)<EOL><DEDENT>if freq is None:<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise ValueError(msg)<EOL><DEDENT>if periods == <NUM_LIT:0>:<EOL><INDENT>return self<EOL><DEDENT>if isinstance(freq, str):<EOL><INDENT>freq = to_offset(freq)<EOL><DEDENT>block_axis = self._get_block_manager_axis(axis)<EOL>if isinstance(index, PeriodIndex):<EOL><INDENT>orig_freq = to_offset(index.freq)<EOL>if freq == orig_freq:<EOL><INDENT>new_data = self._data.copy()<EOL>new_data.axes[block_axis] = index.shift(periods)<EOL><DEDENT>else:<EOL><INDENT>msg = ('<STR_LIT>' %<EOL>(freq.rule_code, orig_freq.rule_code))<EOL>raise ValueError(msg)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>new_data = self._data.copy()<EOL>new_data.axes[block_axis] = index.shift(periods, freq)<EOL><DEDENT>return self._constructor(new_data).__finalize__(self)<EOL>
Shift the time index, using the index's frequency if available.

Parameters
----------
periods : int
    Number of periods to move, can be positive or negative
freq : DateOffset, timedelta, or time rule string, default None
    Increment to use from the tseries module or time rule (e.g. 'EOM')
axis : int or basestring
    Corresponds to the axis that contains the Index

Returns
-------
shifted : NDFrame

Notes
-----
If freq is not specified then tries to use the freq or inferred_freq
attributes of the index. If neither of those attributes exist, a
ValueError is thrown