BUG: Weird behavior for comparison operations eq and ne · Issue #36377 · pandas-dev/pandas (original) (raw)


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd import numpy as np random_state = np.random.RandomState(seed=42) ncols = 64 nrows = 156 test_data = { "col{}".format(int(i)): random_state.randint( 0, 100, size=(nrows) ) for i in range(ncols) } df = pd.DataFrame(test_data) df.eq("a") # it works good nrows = 157 # change row count test_data = { "col{}".format(int(i)): random_state.randint( 0, 100, size=(nrows) ) for i in range(ncols) } df = pd.DataFrame(test_data) df.eq("a") # it doesn't work

ValueError: unknown type str32

nrows = 156 # return row count to valid value ncols = 65 # change col count test_data = { "col{}".format(int(i)): random_state.randint( 0, 100, size=(nrows) ) for i in range(ncols) } df = pd.DataFrame(test_data) df.eq("a") # it doesn't work as well

ValueError: unknown type str32

Problem description

Looks like the problem is related to size of operands for comparison operations. Could anyone explain please? Is it normal behavior?

Output of pd.show_versions()

pandas : 1.1.2
numpy : 1.18.4
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 41.2.0
Cython : None
pytest : 5.4.2
hypothesis : None
sphinx : None
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.14.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : None
fsspec : 0.7.3
fastparquet : None
gcsfs : None
matplotlib : 3.2.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.4.1
sqlalchemy : 1.3.17
tables : 3.6.1
tabulate : None
xarray : 0.15.1
xlrd : 1.2.0
xlwt : None
numba : None