-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: UndefinedVariableError in DataFrame.query with classname #49248
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
…4_bug_dfquery # Conflicts: # doc/source/whatsnew/v1.5.2.rst
The doc build error may possibly be related? https://github.com/pandas-dev/pandas/actions/runs/3303682683/jobs/5451910616 |
Thanks for the feedback @mroeschke. |
Did you build the docs locally with the |
I used both |
From the logs it appears that the errors are not just in |
I was able to replicate the error in the docs with that. But not able to identify why it's throwing |
): | ||
is_local = False | ||
check = self.env.scope.get("column") == local_name | ||
if not isinstance(check, Series) and check: |
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.
Shouldn't self.env.scope.get("column") == local_name
always produce a bool?
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.
yes, ideally it should.
Although the tests were fine, but it threw the error you mentioned up here #49248 (comment)
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 too familiar with this part of the codebase, but is there a way to check if it's local without checking if it's a series?
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.
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.
Can the self.env.scope.get("column")
Series name
just be compared to the local_name
?
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.
so something like
- check if Series
- compare self.env.scope["column"].name with local_name
- if not Series compare directly self.env.scope["column"]
sorry but how is that any better?
EDIT: or did you mean just compare the Series.name? but for most cases, they aren't Series
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.
(This may be my ignorance to this part of the code base), but I assumed that self.env.scope["column"]
would refer to a Series object and the local_name
would refer to the name of the Series so no Series
checking needs to be done.
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.
Oh, no that's not the case. Usually it's name of a df column.
I did the Series check just to cover the Sphinx errors. Maybe someone with better Sphinx knowledge can fix this more elegantly.
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
doc/source/whatsnew/v1.5.2.rst
file if fixing a bug or adding a new feature.xref #47859