Skip to content

Properly handle missing attributes in query/eval strings #32408

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

Merged
merged 10 commits into from
Apr 10, 2020
3 changes: 2 additions & 1 deletion pandas/core/computation/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,9 @@ def visit_Attribute(self, node, **kwargs):
# something like datetime.datetime where scope is overridden
if isinstance(value, ast.Name) and value.id == attr:
return resolved
raise

raise ValueError(f"Invalid Attribute context {ctx.__name__}")
raise ValueError(f"Invalid Attribute context {type(ctx).__name__}")

def visit_Call(self, node, side=None, **kwargs):

Expand Down