-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: int64 overflow/wrap around with sum() #15453
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
Comments
so couple of things.
|
Thanks. Also on 3.6 here, though (win7): In [1]: import bottleneck as bn
In [2]: bn.__version__
Out[2]: '1.2.0'
In [3]: import numpy as np
In [4]: bn.nansum(np.array([2**31],dtype='int64'))
Out[4]: -2147483648
In [5]: import sys
In [6]: sys.version
Out[6]: '3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]' |
yeah ok with simply not using bottleneck on windows for sum always then (though this IS an API change, so needs some documentation, because |
hi everyone, Im using the version 0.19.2 of pandas in win server and i have this overflow problem, it's there a way to solve this issue before the pandas update ? I used the .sum() function in a lot of lines in the code .. |
As this is an issue in |
It has dependency with anaconda... I will try it to remove anyway, and see what happens. |
The In [1]: import pandas as pd
In [2]: s = pd.Series([2**31])
In [3]: s.sum()
Out[3]: -2147483648
In [4]: from pandas.core import nanops
In [5]: nanops._USE_BOTTLENECK
Out[5]: True
In [6]: nanops._USE_BOTTLENECK = False
In [7]: s.sum()
Out[7]: 2147483648 |
Thanks @xflr6 that was awsome !!! |
It seems that the issue in |
Note that this only affects Windows (see above). However, I can confirm that this is fixed in Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import bottleneck as bn
>>> bn.__version__
'1.2.1'
>>> import numpy as np
>>> bn.nansum(np.array([2**31], dtype='int64'))
2147483648L |
actually going to close this, but for another reason. in #15507 (0.21.0RC1 is out now) we no longer use bottleneck for sum or prod, so this is not an issue. |
Code Sample, a copy-pastable example if possible
Problem description
negative values in [3] and [4]
Expected Output
see [5]
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: