BUG: Even though dropna=True
, Series.value_counts()
with arguments normalize=True
and bins=Union[int,IntervalIndex]
, it still counts pd.NA
values.
#44946
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Bug
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
Note: this issue also happens with
pandas.value_counts()
. I actually noticed the problem when I tried to apply this to aDataFrame
(withpd.Int64Dtype
dtypes).As can be seen from the Reproducible Example, the issue only occurs if:
True
is not None
Expected Behavior
Expected Behaviour Output
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.9.9.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.156-1.fc25.qubes.x86_64
Version : #1 SMP Fri Oct 29 02:51:34 CEST 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 58.5.3
Cython : None
pytest : 6.2.5
hypothesis : None
sphinx : 4.3.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.7.1
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.30.1
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.5.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
sqlalchemy : 1.4.27
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: