-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ERR: better error message on invalid .query input #13139
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
Comments
I supppose this could be a better error message. That is invalid input. |
There is already a helper function for that: _check_expression(expr) Problem is, this function is only executed in the for loop: eval.py#L246-L247 A simple I could send a PR(first OS contribution, ever) |
yes u can move it |
… invalid pd.eval and df.query input closes pandas-dev#13139 Added test case to check for invalid input(empy string) on pd.eval('') and df.query(''). Used existing helper function(_check_expression) Author: Thiago Serafim <[email protected]> Closes pandas-dev#14473 from tserafim/issue#13139 and squashes the following commits: 77483dd [Thiago Serafim] ERR: correctly raise ValueError on empty input to pd.eval() and df.query() (pandas-dev#13139) 9a5c55f [Thiago Serafim] Fix GH13139: better error message on invalid pd.eval and df.query input (cherry picked from commit 1308884)
Code Sample
Expected output
If I run query with an empty string I should expect no output, however:
The problem lies on the last line of https://github.com/pydata/pandas/blob/master/pandas/computation/eval.py
I'm not sure of a proper fix so I'm opening this issue instead of pull request.
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: