-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pandas-0.25.0rc0 problem on Python-3.8: 'PandasExprVisitor' object has no attribute 'visit_Constant' #27261
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
well, it's a duplicate of #26318, just now with Pandas-0.25.0rc0 |
This is related to the ast.Constant change in Python 3.8 (where Constant is replacing Str, Num, e..): python/cpython#9445 Some related bpo issues with discussion around breakages and suggested solutions: https://bugs.python.org/issue32892, https://bugs.python.org/issue36917 It seems it shouldn't be to hard to fix this for 0.25. @stonebig can you try if the following patch works? --- a/pandas/core/computation/expr.py
+++ b/pandas/core/computation/expr.py
@@ -590,6 +590,16 @@ class BaseExprVisitor(ast.NodeVisitor):
name = self.env.add_tmp([self.visit(e)(self.env) for e in node.elts])
return self.term_type(name, self.env)
+ def visit_Constant(self, node, **kwargs):
+ if isinstance(node.value, str):
+ self.visit_Str(node)
+ elif node.value in {True, False}:
+ self.visit_NameConstant(node)
+ elif isinstance(node.value, (int, float)):
+ self.visit_Num(node)
+ else:
+ raise Exception("...")
+
visit_Tuple = visit_List |
If I did apply it right, I get now a :
|
pandas-1.0 is really near ? |
I confirm the proposed 2 lines patch fixes the issue. |
Code Sample, a copy-pastable example if possible
blows-up with
The text was updated successfully, but these errors were encountered: