Skip to content

Commit 99d67b5

Browse files
neirbowjTomAugspurger
authored and
TomAugspurger
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 e5fb4c5 commit 99d67b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/computation/align.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ def _reconstruct_object(typ, obj, axes, dtype):
251251

252252
try:
253253
ret = ret_value.item()
254-
except ValueError:
254+
except (ValueError, IndexError):
255+
# XXX: we catch IndexError to absorb a
256+
# regression in numpy 1.7.0
257+
# fixed by numpy/numpy@04b89c63
255258
ret = ret_value
256259
return ret

0 commit comments

Comments
 (0)