-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: allow dataframe get to take an axis argument #11550
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
Conversation
@@ -577,6 +577,30 @@ def _repr_html_(self): | |||
else: | |||
return None | |||
|
|||
def get(self, key, default=None, axis='columns'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just modify the one in core/generic.py
Ok, I used your suggestion and put the tests in (Sorry, Atom couldn't help but by itself remove some spaces that were at the end of their lines) |
I don't understand, why is the build failing? |
If you go to 'Details', you can get the build's output. In this case:
|
Uh, yes, thanks. I think I've identified what is going on, but I'm not sure on how to proceed:
So, basically, the result of the
I could redefine Here is what I'm proposing: if the solution based on the slice and |
""" | ||
# special case (GH 5652) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, this just generates a ValueError
which by definition returns default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That generates a TypeError
("cannot use label indexing with a null key"). But you're right, I can also catch it below...
I'm not sure this is a good idea. Get is a standard method for mapping types and we already have a lot of indexing methods. |
yeh, this is getting into too many edge cases. Lets just keep |
closes #6703
I would have like to have a solution also working for panels, but I've never used them, so I'm not sure how it should behave.