<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 3, 2017 at 3:05 PM, Nathaniel Smith <span dir="ltr"><<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">It's possible we should back off to just issuing a deprecation warning in 1.12?</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Jan 3, 2017 1:47 PM, "Yaroslav Halchenko" <<a href="mailto:lists@onerussian.com" target="_blank">lists@onerussian.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hm... testing on current master (first result is from python's pow)<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.13.0.dev0+02e2ea8')<br>
0.25<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
testing on Debian's packaged beta<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.12.0b1')<br>
0.25<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
testing on stable debian box with elderly numpy, where it does behave sensibly:<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.8.2')<br>
0.25<br>
0<br>
<br>
what am I missing?<br>
<br></blockquote></div></div></div></div></blockquote><div><br></div><div>2 ** -2 should be 0.25.</div><div><br></div><div>On old versions of NumPy, you see the the incorrect answer 0. We are now preferring to give an error rather than the wrong answer.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>    The pandas test suite triggered this behavior, but not intentionally, and<br>
>    should be fixed in the next release:<br>
>    <a href="https://github.com/pandas-dev/pandas/pull/14498" rel="noreferrer" target="_blank">https://github.com/pandas-dev/<wbr>pandas/pull/14498</a><br>
<br>
I don't think that was the full set of cases, e.g.<br>
<br>
(git)hopa/sid-i386:~exppsy/pan<wbr>das[bf-i386]<br>
$> nosetests -s -v pandas/tests/test_expressions.<wbr>py:TestExpressions.test_mixed_<wbr>arithmetic_series<br>
test_mixed_arithmetic_series (pandas.tests.test_expressions<wbr>.TestExpressions) ... ERROR<br>
<br>
==============================<wbr>==============================<wbr>==========<br>
ERROR: test_mixed_arithmetic_series (pandas.tests.test_expressions<wbr>.TestExpressions)<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
Traceback (most recent call last):<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/tests/test_<wbr>expressions.py", line 223, in test_mixed_arithmetic_series<br>
    self.run_series(self.mixed2[co<wbr>l], self.mixed2[col], binary_comp=4)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/tests/test_<wbr>expressions.py", line 164, in run_series<br>
    test_flex=False, **kwargs)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/tests/test_<wbr>expressions.py", line 93, in run_arithmetic_test<br>
    expected = op(df, other)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/core/ops.py", line 715, in wrapper<br>
    result = wrap_results(safe_na_op(lvalue<wbr>s, rvalues))<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/core/ops.py", line 676, in safe_na_op<br>
    return na_op(lvalues, rvalues)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/core/ops.py", line 652, in na_op<br>
    raise_on_error=True, **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/computation/<wbr>expressions.py", line 210, in evaluate<br>
    **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-exppsy<wbr>/pandas/pandas/computation/<wbr>expressions.py", line 63, in _evaluate_standard<br>
    return op(a, b)<br>
ValueError: Integers to negative integer powers are not allowed.<br></blockquote></div></div></div></div></blockquote><div><br></div><div>Agreed, it looks like pandas still has this issue in the test suite. Nonetheless, I don't think this should be an issue for users -- pandas defines all handling of arithmetic to numpy.</div></div><br></div></div>