BUG: Series.is_unique does not consider single occurrences of NaN unique · Issue #25180 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
On master
:
In [1]: import numpy as np; import pandas as pd; pd.version Out[1]: '0.25.0.dev0+67.gf04bb2fc9'
In [2]: pd.Series(['foo', 'bar', np.nan]).is_unique Out[2]: False
In [3]: pd.Series([np.nan]).is_unique Out[3]: False
Note that indexes consider the equivalent cases to be unique:
In [4]: pd.Index(['foo', 'bar', np.nan]).is_unique Out[4]: True
In [5]: pd.Float64Index([np.nan]).is_unique Out[5]: True
Problem description
Series.is_unique
does not consider single occurrences of NaN
to be unique.
Expected Output
I'd expect [2]
and [3]
to be True
.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: f04bb2f
python: 3.6.8.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.25.0.dev0+67.gf04bb2fc9
pytest: 4.0.2
pip: 9.0.1
setuptools: 40.6.3
Cython: 0.28.2
numpy: 1.14.6
scipy: 1.0.0
pyarrow: 0.6.0
xarray: 0.9.6
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 0.9.8
lxml.etree: 3.8.0
bs4: None
html5lib: 0.999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: 0.1.5
pandas_gbq: None
pandas_datareader: None
gcsfs: None