Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
combine_first throws ValueError: Cannot convert NA to integer #14687
Comments
jorisvandenbossche
added Bug Regression
labels
Nov 18, 2016
|
This seems to be a regression from 0.18, as this worked before:
@Dmitrii-I Thanks for the report! Always welcome to look into what could have caused this change. |
jorisvandenbossche
added this to the
0.19.2
milestone
Nov 18, 2016
This was referenced Nov 25, 2016
Closed
jorisvandenbossche
closed this
in #14886
Dec 16, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dmitrii-I commentedNov 18, 2016
•
edited by jorisvandenbossche
I do not understand why there is a need to convert NA to integer if the result does not have NAs. Perhaps the combine_first algo needs to do it under the hood?
A small, complete example of the issue
Expected Output
It does work when at least one item is a float:
DataFrame({'a': [0.0, 1, 3, 5]}).combine_first(DataFrame({'a': [1, 4]})) a 0 0.0 1 1.0 2 3.0 3 5.0I am aware that integer series cannot have NAs but there is no need to introduce NAs here. I do like it that the series is not upcasted to float silently though.
Output of
pd.show_versions()INSTALLED VERSIONS
commit: None
python: 3.4.3.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-66-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.19.0
nose: None
pip: 1.5.4
setuptools: 3.3
Cython: 0.24.1
numpy: 1.11.2
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.0.0
sphinx: None
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.6
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.9.2
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None