pydata/pandas — Issue #816: np.diff fails when called on a Series
Author: wesm
Created: 2012-02-23 05:05:39+00:00
State: open
Labels: Bug, prio-high

```
In [13]: s = Series(np.arange(10))

In [14]: np.diff(s)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/wesm/code/pandas/ in ()
----> 1 np.diff(s)

/usr/lib/epd-7.1/lib/python2.7/site-packages/numpy/lib/function_base.pyc in diff(a, n, axis)
975 return diff(a[slice1]-a[slice2], n-1, axis=axis)
976 else:
--> 977 return a[slice1]-a[slice2]
978
979 def interp(x, xp, fp, left=None, right=None):

/home/wesm/code/pandas/pandas/core/series.pyc in __getitem__(self, key)
392 key = np.asarray(key, dtype=bool)
393
--> 394 return self._get_with(key)
395
396 def _get_with(self, key):

/home/wesm/code/pandas/pandas/core/series.pyc in _get_with(self, key)
406 else:
407 if isinstance(key, tuple):
--> 408 return self._get_values_tuple(key)
409
410 if not isinstance(key, (list, np.ndarray)): # pragma: no cover

/home/wesm/code/pandas/pandas/core/series.pyc in _get_values_tuple(self, key)
437
438 if not isinstance(self.index, MultiIndex):
--> 439 raise ValueError('Can only tuple-index with a MultiIndex')
440
441 # If key is contained, would have returned by now

ValueError: Can only tuple-index with a MultiIndex
```