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
The output was 2.
It seems that nunique can only ignore None or np.nan but not both together. This seems odd to me and I think it
should either be changed or the docs should reflect this.
Expected Output
I expected to get 1 as the result but I got 2.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.7.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.49+
Version : #1 SMP Sun Oct 18 19:43:35 PDT 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8
So it always subtracts 1, instead of checking how many NA-like values are present in the uniques. So we should be subtracting isna(uniqs).sum() instead, I think.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The output was 2.
It seems that nunique can only ignore None or np.nan but not both together. This seems odd to me and I think it
should either be changed or the docs should reflect this.
Expected Output
I expected to get 1 as the result but I got 2.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : db08276
python : 3.7.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.49+
Version : #1 SMP Sun Oct 18 19:43:35 PDT 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.3
numpy : 1.18.5
pytz : 2019.3
dateutil : 2.8.1
pip : 20.2.4
setuptools : 46.1.3.post20200325
Cython : 0.29.21
pytest : 5.4.1
hypothesis : 5.10.0
sphinx : 3.0.2
blosc : None
feather : 0.4.1
xlsxwriter : 1.2.8
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.13.0
pandas_datareader: 0.9.0
bs4 : 4.9.0
bottleneck : 1.3.2
fsspec : 0.8.4
fastparquet : None
gcsfs : 0.6.1
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.5.1
scipy : 1.4.1
sqlalchemy : 1.3.16
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.48.0
The text was updated successfully, but these errors were encountered: