Closed
Description
Not sure if this is intentional, but Series.shift() won't run with categorical dtypes:
ser = pd.Series(['a', 'b', 'c', 'd'], dtype="category")
ser.shift(1)
Traceback (most recent call last):
File "<ipython-input-15-1a7536b0af06>", line 1, in <module>
ser.shift(1)
File "/.../pandas/core/generic.py", line 3394, in shift
new_data = self._data.shift(periods=periods, axis=block_axis)
File "/.../pandas/core/internals.py", line 2533, in shift
return self.apply('shift', **kwargs)
File "/.../pandas/core/internals.py", line 2497, in apply
applied = getattr(b, f)(**kwargs)
File "/.../pandas/core/internals.py", line 893, in shift
new_values, fill_value = com._maybe_upcast(self.values)
File "/.../pandas/core/common.py", line 1218, in _maybe_upcast
new_dtype, fill_value = _maybe_promote(dtype, fill_value)
File "/.../pandas/core/common.py", line 1124, in _maybe_promote
if issubclass(np.dtype(dtype).type, compat.string_types):
TypeError: data type not understood