We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This works:
In [141]: dates = pd.to_datetime(['2013-09-03', '2013-09-04', '2013-09-05']) pd.concat({'A':pd.Series([1,3,4], index=dates), 'B':pd.Series([1,3,4], index=dates)}).to_frame().xs(key='2013-09-03', level=1) 0 A 1 B 1 [2 rows x 1 columns]
but this does not:
In [142]: dates = pd.to_datetime(['2013-09-03', '2013-09-04', '2013-09-05']) pd.concat({'A':pd.Series([1,3,4], index=dates), 'B':pd.Series([1,3,4], index=dates)}).xs(key='2013-09-03', level=1) --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-142-06aba7d44961> in <module>() 1 dates = pd.to_datetime(['2013-09-03', '2013-09-04', '2013-09-05']) ----> 2 pd.concat({'A':pd.Series([1,3,4], index=dates), 'B':pd.Series([1,3,4], index=dates)}).xs(key='2013-09-03', level=1) /usr/lib64/python2.7/site-packages/pandas/core/series.py in _xs(self, key, axis, level, copy) 437 438 def _xs(self, key, axis=0, level=None, copy=True): --> 439 return self.__getitem__(key) 440 441 xs = _xs /usr/lib64/python2.7/site-packages/pandas/core/series.py in __getitem__(self, key) 482 def __getitem__(self, key): 483 try: --> 484 result = self.index.get_value(self, key) 485 if isinstance(result, np.ndarray): 486 return self._constructor(result,index=[key]*len(result)).__finalize__(self) /usr/lib64/python2.7/site-packages/pandas/core/index.py in get_value(self, series, key) 2294 raise InvalidIndexError(key) 2295 else: -> 2296 raise e1 2297 except Exception: # pragma: no cover 2298 raise e1 KeyError: '2013-09-03'
The text was updated successfully, but these errors were encountered:
hmm...should work...odd...marking as a bug
Sorry, something went wrong.
I am running this on v0.13, so it might be fixed in master.
this is still present
of course when reporting pls give a try on master anyhow
Probably related: #5684
I think I took a shot at fixing it, but scared off by the indexing code :)
@TomAugspurger
#6259 should fix this issue; can you check if fixes the related; if so you want to add another commit with tests for that one
xs was pretty broken - too many special cases ; not a whole lot of tests though
@jreback that seems to have fixed it. Thanks!
gr8 do you want to add those tests on?
jreback
Successfully merging a pull request may close this issue.
This works:
but this does not:
The text was updated successfully, but these errors were encountered: