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
I have objects in the items axis of a Panel, selecting by an object gets me an infinite recursion.
import pandas as pd import numpy as np class Key: def __init__(self, name, id): self.name = name self.id = id def __repr__(self): return "Key(name={name}, id={id})".format(**self.__dict__) names = ['dale', 'bob', 'frank'] N = len(names) items = [Key(name, id) for name, id in zip(names, range(1, N+1))] panel = pd.Panel(np.random.randn(N, 10, 10), items=items) panel.ix[items[0]] # infinite recursion super(pd.Panel, panel).__getitem__(items[0]) # works
It appears the issue is that the Key object isn't be counted as scalar in the Panel.__getitem__
Key
Panel.__getitem__
253 def __getitem__(self, key): 254 if isinstance(self._info_axis, MultiIndex): 255 return self._getitem_multilevel(key) 256 if lib.isscalar(key): 257 return super(Panel, self).__getitem__(key) 258 return self.ix[key]
The text was updated successfully, but these errors were encountered:
wow, how'd I miss the issue right before this. #9140
closing since this is a dupe.
Sorry, something went wrong.
No branches or pull requests
I have objects in the items axis of a Panel, selecting by an object gets me an infinite recursion.
It appears the issue is that the
Key
object isn't be counted as scalar in thePanel.__getitem__
The text was updated successfully, but these errors were encountered: