@@ -138,7 +138,7 @@ def _check_for_locals(expr, stack_level, parser):
138
138
139
139
def eval (expr , parser = 'pandas' , engine = 'numexpr' , truediv = True ,
140
140
local_dict = None , global_dict = None , resolvers = (), level = 0 ,
141
- target = None , assignment_allowed = True ):
141
+ target = None ):
142
142
"""Evaluate a Python expression as a string using various backends.
143
143
144
144
The following arithmetic operations are supported: ``+``, ``-``, ``*``,
@@ -196,9 +196,6 @@ def eval(expr, parser='pandas', engine='numexpr', truediv=True,
196
196
scope. Most users will **not** need to change this parameter.
197
197
target : a target object for assignment, optional, default is None
198
198
essentially this is a passed in resolver
199
- assignment_allowed : bool
200
- Whether the eval should be able to modify the input through
201
- assigment.
202
199
203
200
Returns
204
201
-------
@@ -239,11 +236,7 @@ def eval(expr, parser='pandas', engine='numexpr', truediv=True,
239
236
240
237
# assign if needed
241
238
if env .target is not None and parsed_expr .assigner is not None :
242
- if assignment_allowed :
243
- env .target [parsed_expr .assigner ] = ret
244
- return None
245
- else :
246
- raise ValueError ("Expression includes assignment statement: \n "
247
- "\t not allowed from DataFrame.query" )
239
+ env .target [parsed_expr .assigner ] = ret
240
+ return None
248
241
249
242
return ret
0 commit comments