ERR: Index.shift() gives confusing error message when no DatetimeIndex · Issue #8038 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
In [1]: idx = pd.Index(range(5))
In [2]: idx
Out[2]: Int64Index([0, 1, 2, 3, 4], dtype='int64')
In [3]: idx.shift(1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-d8362983dbf7> in <module>()
----> 1 idx.shift(1)
c:\users\vdbosscj\scipy\pandas-joris\pandas\core\index.pyc in shift(self, period
s, freq)
1096 return self
1097
-> 1098 offset = periods * freq
1099 return Index([idx + offset for idx in self], name=self.name)
1100
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
Should shift
be allowed at all when it is no DatetimeIndex
?