You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>>s=pd.Series(['foo', 1])
>>>s>1# fails as expectedTraceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/mdank/anaconda3/envs/pd-mixed/lib/python3.6/site-packages/pandas/core/ops.py", line879, inwrapperres=na_op(values, other)
File"/home/mdank/anaconda3/envs/pd-mixed/lib/python3.6/site-packages/pandas/core/ops.py", line783, inna_opresult=_comp_method_OBJECT_ARRAY(op, x, y)
File"/home/mdank/anaconda3/envs/pd-mixed/lib/python3.6/site-packages/pandas/core/ops.py", line763, in_comp_method_OBJECT_ARRAYresult=lib.scalar_compare(x, y, op)
File"pandas/_libs/lib.pyx", line706, inpandas._libs.lib.scalar_compareTypeError: '>'notsupportedbetweeninstancesof'str'and'int'>>>s.to_frame() >1# should also fail, gives wrong result instead00True1True
Problem description
String to int comparison doesn't fail when comparing a DataFrame. It fails when comparing Series with mixed types, but in case of DataFrame it just silently produces wrong result.
Code Sample, a copy-pastable example if possible
Problem description
String to int comparison doesn't fail when comparing a
DataFrame
. It fails when comparingSeries
with mixed types, but in case ofDataFrame
it just silently produces wrong result.Expected Output
TypeError in both cases -
Series
andDataFrame
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-104-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.22.0
pytest: None
pip: 9.0.3
setuptools: 39.0.1
Cython: None
numpy: 1.14.2
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: