Skip to content

Calling xs on DataFrame with index but no columns raises Exception #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wesm opened this issue Aug 9, 2011 · 0 comments
Closed

Calling xs on DataFrame with index but no columns raises Exception #98

wesm opened this issue Aug 9, 2011 · 0 comments
Labels

Comments

@wesm
Copy link
Member

wesm commented Aug 9, 2011

example:

In [1]: df = DataFrame(index=['a', 'b', 'c'])

In [2]: df.ix['a']
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (2, 0))

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/home/wesm/code/pandas/<ipython-input-2-6181dcf1ffea> in <module>()
----> 1 df.ix['a']

/home/wesm/code/pandas/pandas/core/indexing.pyc in __getitem__(self, key)
    102             return self._fancy_getitem(key, axis=0)
    103         else:
--> 104             return self._fancy_getitem_axis(key, axis=0)
    105 
    106     def __setitem__(self, key, value):

/home/wesm/code/pandas/pandas/core/indexing.pyc in _fancy_getitem_axis(self, key, axis)
    200                 return self.frame.xs(idx)
    201             else:
--> 202                 return self.frame.xs(idx, copy=False)
    203         else:
    204             col = key

/home/wesm/code/pandas/pandas/core/frame.pyc in xs(self, key, copy)
    839 
    840         self._consolidate_inplace()
--> 841         values = self._data.xs(key, axis=1, copy=copy)
    842         return Series(values.as_matrix(), index=self.columns)
    843 

/home/wesm/code/pandas/pandas/core/internals.pyc in xs(self, key, axis, copy)
    451                 new_blocks.append(newb)
    452         else:
--> 453             vals = self.blocks[0].values[slicer]
    454             if copy:
    455                 vals = vals.copy()

IndexError: list index out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant