-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DataFrame.drop fails when columns argument given tuple #43985
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
BUG: DataFrame.drop fails when columns argument given tuple #43985
Conversation
labels = list(labels) | ||
else: | ||
labels = [labels] | ||
|
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.
Would this change behavior for tuple
column names?
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.
Good point, fails indeed, added test for it, will try to resolve.
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 sure if it is resolvable - if you sometimes treat a tuple
as a label and sometimes unpack as a list, seems like there would be unavoidable ambiguities? Would be more inclined to say the behavior is correct as is, but haven't thought about it too much
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.
I see your point and there probably is some ambiguity since we can also use tuples to drop MultiIndex. I can revert the changes and just add a test that the described case always raises.
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.
sounds great, thanks!
I dont like allowing tuples as sequence input. See: #42329 (comment) |
Closed this for now since it is not clear how to proceed and there is ambiguity around using tuples for indexing. |
columns=
is given as tuple #43978