pandas-dev / pandas Public
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: wrong/confusing error message in DataFrame.take with a scalar indexer #42875
Comments
Can I take up this issue? |
Yes, certainly! |
Sir can I take this issue? Im new to the contrib community. |
@Arnab1181412 as you can read in the message above, somebody else already asked that an hour ago. So let's first give some time to @radioactive11 to try. |
@jorisvandenbossche I am working on this issue. Just wanted to approve my approach. Currently, an assertion is being raised if Instead, we want to raise a |
This is raised inside the Index._simple_new. But for fixing this PR, I would add a check higher up in Index.take to avoid that we pass a non-ndarray to Index._simple_new |
@jorisvandenbossche Sure sir and I had one query that how will I know that the issue has been merged successfully . |
@Arnab1181412 you will get a notification when this issue would get closed. |
@jorisvandenbossche Sir can I take up this issue? |
Sir, instead of scalar indexer, we should ideally pass a scalar array of indices. This is what I gathered from the documentation, and the error message hints towards the same thing, that it is expecting an array (I had similar issue in some other project I was doing). I hope this is resolved. |
@a-n-622 We should pass an array-like indexer in .take(). The goal of this issue is to improve the error message when a scalar indexer is passed. |
@radioactive11 got it. I am viewing the discussion on #42886 now. thanks. |
Hello everyone, I am working on this issue. I have understood the problem and hopefully will solve it by tomorrow. |
@S-T-A-R-L-O-R-D thanks for showing interest but I already have a PR open and have almost solved the issue. |
ok |
Is the issue solved? |
@Anupam-USP I am currently working on the issue. I have added an appropriate error message and handled the error as well. However, I am unable to pass all the tests and am currently investigating the tests which are failing |
I see that this issue is still open with no comments in the past 1.5 months. I would like to take this issue. |
take |
FYI, I'm @ADing4818 's teammate for a project, so I'll be creating the PR for this issue on behalf of him. |
take
requires an array-like for the indexer, but when passing a scalar you get a not very useful error message as above. We should raise a ValueError (or rather TypeError) instead with an informative message.It actually comes from the Index take implementation:
The text was updated successfully, but these errors were encountered: