@@ -61,6 +61,7 @@ def _evaluate_standard(op, op_str, a, b, raise_on_error=True, **eval_kwargs):
61
61
_store_test_result (False )
62
62
return op (a , b )
63
63
64
+
64
65
def _can_use_numexpr (op , op_str , a , b , dtype_check ):
65
66
""" return a boolean if we WILL be using numexpr """
66
67
if op_str is not None :
@@ -86,7 +87,8 @@ def _can_use_numexpr(op, op_str, a, b, dtype_check):
86
87
return False
87
88
88
89
89
- def _evaluate_numexpr (op , op_str , a , b , raise_on_error = False , ** eval_kwargs ):
90
+ def _evaluate_numexpr (op , op_str , a , b , raise_on_error = False , truediv = True ,
91
+ ** eval_kwargs ):
90
92
result = None
91
93
92
94
if _can_use_numexpr (op , op_str , a , b , 'evaluate' ):
@@ -96,7 +98,8 @@ def _evaluate_numexpr(op, op_str, a, b, raise_on_error=False, **eval_kwargs):
96
98
result = ne .evaluate ('a_value %s b_value' % op_str ,
97
99
local_dict = {'a_value' : a_value ,
98
100
'b_value' : b_value },
99
- casting = 'safe' , ** eval_kwargs )
101
+ casting = 'safe' , truediv = truediv ,
102
+ ** eval_kwargs )
100
103
except (ValueError ) as detail :
101
104
if 'unknown type object' in str (detail ):
102
105
pass
@@ -112,10 +115,12 @@ def _evaluate_numexpr(op, op_str, a, b, raise_on_error=False, **eval_kwargs):
112
115
113
116
return result
114
117
118
+
115
119
def _where_standard (cond , a , b , raise_on_error = True ):
116
120
return np .where (_values_from_object (cond ), _values_from_object (a ),
117
121
_values_from_object (b ))
118
122
123
+
119
124
def _where_numexpr (cond , a , b , raise_on_error = False ):
120
125
result = None
121
126
@@ -190,10 +195,10 @@ def where(cond, a, b, raise_on_error=False, use_numexpr=True):
190
195
return _where_standard (cond , a , b , raise_on_error = raise_on_error )
191
196
192
197
193
- def set_test_mode (v = True ):
198
+ def set_test_mode (v = True ):
194
199
"""
195
- Keeps track of whether numexpr was used. Stores an additional ``True`` for
196
- every successful use of evaluate with numexpr since the last
200
+ Keeps track of whether numexpr was used. Stores an additional ``True``
201
+ for every successful use of evaluate with numexpr since the last
197
202
``get_test_result``
198
203
"""
199
204
global _TEST_MODE , _TEST_RESULT
0 commit comments