BUG: #44334
Labels
Dtype Conversions
Unexpected or buggy dtype conversions
Duplicate Report
Duplicate issue or pull request
NA - MaskedArrays
Related to pd.NA and nullable extension arrays
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
Conversion of strings with valid integer numeric content to nullable integer fails with "TypeError: cannot safely cast non-equivalent object to int64".
Exception raised pandas/core/arrays/integer.py", line 136, in safe_cast
Expected Behavior
IMHO conversion of valid strings to nullable integer should succeed, to be consistent with regular integers.
Installed Versions
Besides the versions used below (python3.9 from Ubuntu repo and pandas master branch from Github), it also fails with python3.7 (self compiled), python3.8 and 3.9 (from Ubuntu repo) and python3.10 (self compiled) with pandas installed from pypi (version 1.3.4).
INSTALLED VERSIONS
commit : 057c6f8
python : 3.9.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.11.0-38-generic
Version : #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.0.dev0+1053.g057c6f81b4
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.2
pip : 20.0.2
setuptools : 44.0.0
Cython : 0.29.24
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: