Skip to content

np.diff fails when called on a Series #816

Closed
@wesm

Description

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

In [14]: np.diff(s)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/wesm/code/pandas/<ipython-input-14-b5f9fe77ab7c> in <module>()
----> 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugInternalsRelated to non-user accessible pandas implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions