-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: ValueError: cannot convert float NaN to integer - on dataframe.reset_index() #35657
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 @capelastegui for the report. This is a duplicate of #35606 |
Sorry about the duplicate! I had looked at that issue, and thought that it was a similar error, but not quite the same. |
the second failing case maybe different, does not involve datetime so will reopen for now.
|
depends in the dtype which is datetime64 so constructing a mutliindex with empty levels and codes does not recreate issue. PR with fix shortly |
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
Problem description
On pandas 1.1.0, I'm getting a ValueError exception when calling dataframe.reset_index() under the following conditions:
The exception message is
ValueError: cannot convert float NaN to integer
.Error trace:
This error didn't happen on pandas 1.0.3 and earlier. I haven't tested any intermediate releases, nor the master branch.
Expected Output
No exception is raised, returns an empty dataframe.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.6.6.final.0
python-bits : 64
OS : Darwin
OS-release : 18.6.0
Version : Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_GB.UTF-8
pandas : 1.1.0
numpy : 1.17.4
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 49.1.0
Cython : None
pytest : 5.3.4
hypothesis : None
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.2
html5lib : None
pymysql : None
psycopg2 : 2.8.4 (dt dec pq3 ext lo64)
jinja2 : 2.10.3
IPython : None
pandas_datareader: None
bs4 : 4.8.1
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.2
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.3.3
sqlalchemy : 1.3.11
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: