@@ -589,6 +589,7 @@ def visitor(x, y):
589
589
590
590
_python_not_supported = frozenset (['Dict' , 'Call' , 'BoolOp' , 'In' , 'NotIn' ])
591
591
_numexpr_supported_calls = frozenset (_reductions + _mathops )
592
+ _query_not_supported = frozenset (['Assign' ])
592
593
593
594
594
595
@disallow ((_unsupported_nodes | _python_not_supported ) -
@@ -602,6 +603,17 @@ def __init__(self, env, engine, parser,
602
603
super (PandasExprVisitor , self ).__init__ (env , engine , parser , preparser )
603
604
604
605
606
+ @disallow ((_unsupported_nodes | _python_not_supported | _query_not_supported ) -
607
+ (_boolop_nodes | frozenset (['BoolOp' , 'Attribute' , 'In' , 'NotIn' ,
608
+ 'Tuple' ])))
609
+ class PandasQueryExprVisitor (BaseExprVisitor ):
610
+
611
+ def __init__ (self , env , engine , parser ,
612
+ preparser = partial (_preparse , f = compose (_replace_locals ,
613
+ _replace_booleans ))):
614
+ super (PandasQueryExprVisitor , self ).__init__ (env , engine , parser , preparser )
615
+
616
+
605
617
@disallow (_unsupported_nodes | _python_not_supported | frozenset (['Not' ]))
606
618
class PythonExprVisitor (BaseExprVisitor ):
607
619
@@ -659,4 +671,5 @@ def names(self):
659
671
return frozenset (term .name for term in com .flatten (self .terms ))
660
672
661
673
662
- _parsers = {'python' : PythonExprVisitor , 'pandas' : PandasExprVisitor }
674
+ _parsers = {'python' : PythonExprVisitor , 'pandas' : PandasExprVisitor ,
675
+ 'pandas_query' : PandasQueryExprVisitor }
0 commit comments