-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: query
on columns with characters like # in its name
#59296
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: query
on columns with characters like # in its name
#59296
Conversation
2ef2fdb
to
101c71d
Compare
7286029
to
bf69392
Compare
1743a58
to
612a6ff
Compare
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.
Minor comments / questions but overall this looks great. @jreback in case you have more feedback on your end
pandas/core/computation/parsing.py
Outdated
# end of a double-quoted string | ||
elif (parse_state == ParseState.IN_DOUBLE_QUOTE) and (s[i - 1] != "\\"): | ||
parse_state = ParseState.DEFAULT | ||
substr += char |
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'm assuming these strings don't get too large, but would definitely be better for performance to collect each element you loop over into a list and join at the end, rather than using add assignment
5ce3201
to
5e0631d
Compare
@aram-cinnamon for the pre-commit issue you can see if you find anything of note in https://github.com/pre-commit/pygrep-hooks/issues, but I am doubtful that there is any real solve. You may just need to add |
Thanks so much Will!! |
Hm tests still failing. Will look into it soon |
Hmm the failure on the |
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.
lgtm @mroeschke
Thanks @aram-cinnamon - very impressive! |
Great work! Had been hoping to see this in the next patch release which was |
It will be part of the 3.0 release |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This PR first added parsing.py: #28215
The issue is that none of the libraries
tokenize
,ast
, ornumexpr
handle # the way we want it to.tokenize
is used here:pandas/pandas/core/computation/expr.py
Line 169 in 18a3eec
pandas/pandas/core/computation/parsing.py
Line 186 in 18a3eec
ast
is used here:pandas/pandas/core/computation/expr.py
Line 407 in 18a3eec
numexpr
is used here:pandas/pandas/core/computation/engines.py
Line 129 in 18a3eec