-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
pd.where OverflowError with large numbers #31687
Comments
Seems to be still broken on 1.0.1. |
print(df.where(pd.notnull(df), 'some_str')) raises the same exception. Debugging through the code, it seems on this line new_result = trans(result).astype(dtype), the astype method is to blame. dtype here is int64 |
looks like #29139 (i.e. 1.0.0) 225cc92 is the first bad commit
|
also affected by this bug |
Same here. However got it using df.replace({pd.NaT: None}) instead of df.where(pd.notnull(df), None) |
@TomAugspurger adding the blocker tag as several users affected by this regression. |
@simonjayhawkins i suppose this is ok for 1.1 as a blocker, though generally we should not simply block on things, this would delay releases indefinitly which is a much worse problem. |
still broken in 1.1.3 |
for all those commenting 'this is still broken' - well it's an open issue you are welcome to propose a patch |
sorry, it was marked as a blocker for 1.1 and I was not sure about its status |
An added observation is that this seems to still be breaking with numbers smaller than
This still causes the same error |
take |
This looks to work on master now (
|
edited:
|
take |
Looks like this was fixed by #39761 |
Code Sample, a copy-pastable example if possible
Problem description
The above code does not work with 1.0.0, but used to work with at least 0.25.0.
Replacing large floats with pd.where breaks
Running pd.where on a dataframe that contains large float values and the replacement value is of a different dtype throws
OverflowError: int too big to convert
:Replacing data one column at a time works.
Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.0.0
numpy : 1.16.2
pytz : 2018.9
dateutil : 2.8.0
pip : 10.0.1
setuptools : 39.1.0
Cython : None
pytest : 4.4.0
hypothesis : None
sphinx : 2.0.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.3.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.3
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 4.4.0
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.3
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: