Comparison to string is broken for nullable int #28930
Labels
ExtensionArray
Extending pandas with custom dtypes or arrays.
Numeric Operations
Arithmetic, Comparison, and Logical operations
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
Problem description
The above raises TypeError on line 627 in integer.py:
Here, the result is bool. Here is the exception:
Traceback (most recent call last):
File "", line 1, in
File "C:\Python37\lib\site-packages\pandas\core\ops.py", line 1731, in wrapper
return dispatch_to_extension_op(op, self, other)
File "C:\Python37\lib\site-packages\pandas\core\ops.py", line 1220, in dispatch_to_extension_op
res_values = op(new_left, new_right)
File "C:\Python37\lib\site-packages\pandas\core\arrays\integer.py", line 564, in cmp_method
result[mask] = True if op_name == 'ne' else False
TypeError: 'bool' object does not support item assignment
The above works as expected for float64 and other numeric types.
Expected Output
0 False
1 False
Name: x, dtype: bool
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.0.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.1
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.2.3
setuptools : 39.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.3.4
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.4
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.0
sqlalchemy : 1.3.5
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: