8000 BUG: Work-around a numpy regression affecting pandas.eval() with numexpr by neirbowj · Pull Request #5666 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Work-around a numpy regression affecting pandas.eval() with numexpr #5666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
neirbowj committed Dec 9, 2013
commit 2bcb163440164f0c2793b01012bdb3bf77fe8e59
5 changes: 4 additions & 1 deletion pandas/computation/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ def _reconstruct_object(typ, obj, axes, dtype):

try:
ret = ret_value.item()
except ValueError:
except (ValueError, IndexError):
# XXX: we catch IndexError to absorb a
# regression in numpy 1.7.0
# fixed by numpy/numpy@04b89c63
ret = ret_value
return ret
0