-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pd.Series.isin has different behaviour based on number of rows #25395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I got curious and did some testing. Looks like the behavior difference is isolated to I took a look inside the relevant code and over 1M there is a switch as to how The snippet below shows a = np.array([np.nan, 1])
np.in1d(a, [np.nan]) |
@dimitar-petrov Thanks for the report! Very welcome to look into it / do a PR! |
I think this is related to #22205 |
Would a solution be to disallow nans in |
this is a duplicate of #22205 should filter NaN's internally before passing to |
Code Sample, a copy-pastable example if possible
Problem description
The behaviour is not consistent. The example above should be descriptive enough.
Expected Output
Accurate result of pd.Series.isin should not depend on series length.
Both cases should accurately count 1 row containing np.Nan
Output of
pd.show_versions()
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.20.8-arch1-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: en_US.utf-8
LANG: en_US.utf-8
LOCALE: en_US.UTF-8
pandas: 0.23.4
pytest: 4.0.1
pip: 18.1
setuptools: 40.6.2
Cython: None
numpy: 1.15.4
scipy: 1.2.0
pyarrow: 0.11.1
xarray: 0.11.0
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.9
blosc: 1.6.2
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 3.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: 0.2.1
pandas_gbq: None
pandas_datareader: 0.7.0
The text was updated successfully, but these errors were encountered: