-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DataFrame size overflows on Windows #34557
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
Thanks for the report. Are you interested in working on this? What's your expected output for the sum? Would it be equivalent to this on a 64-bit system? In [19]: pd.DataFrame({"A": np.array([np.iinfo('int64').max] * 2)}).sum()
Out[19]:
A -2
dtype: int64 |
I would be happy to try and fix. Your snippet, however, doesn't represent the problem. It's about the size of the array, not the contents. The expected output would be (running my original code on redhat linux 64bit): import pandas as pd
import numpy as np
a = np.ones(2**30 + 1, dtype=np.int8)
df = pd.DataFrame.from_dict({'a': a, 'b': a})
print(df.size) # --> 2147483650
print(df.sum(axis=0)) # -->
# a 1073741825
# b 1073741825
# dtype: int64 |
Agreed that my example doesn't demonstrate the |
I see. I'd expect the result of |
The size issue is coming up in #35227 too.[ Will leave this open for the overflow issue.
I think that's the part that we need to clarify. We should (I think) have consistent behavior across windows / linux. We might have different behavior between 32 and 64-bit systems. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
On windows, dataframes with more than 2^31 elements (max 32 bit int) result in negative sizes and nan results from operations performed on them.
This problem only seems to exist on windows (64-bit Windows-10-10.0.18362-SP0). This seems to be from the assumption that
np.prod(self.shape)
will not overflow, but numpy makes no such guarantee.Expected Output
positive size, non-nan sum
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.0.1
numpy : 1.16.4
pytz : 2018.9
dateutil : 2.8.0
pip : 19.2.2
setuptools : 41.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: