Skip to content

Commit 2bcb163

Browse files
committed
BUG: Work-around a numpy regression
numpy 1.7.0 erroneously raises IndexError instead of ValueError from ndarray.item() when the array is not of length 1. This can be seen as a failure of computation.tests.test_eval.TestScope.test_global_scope for the cases that engine='numexpr'. Absorb the splatter from this regression by explicitly catching the erroneous IndexError.
1 parent 98e48ca commit 2bcb163

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/computation/align.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ def _reconstruct_object(typ, obj, axes, dtype):
249249

250250
try:
251251
ret = ret_value.item()
252-
except ValueError:
252+
except (ValueError, IndexError):
253+
# XXX: we catch IndexError to absorb a
254+
# regression in numpy 1.7.0
255+
# fixed by numpy/numpy@04b89c63
253256
ret = ret_value
254257
return ret

0 commit comments

Comments
 (0)