Series.value_counts doesn't respect dropna = False for categorical series · Issue #9443 · pandas-dev/pandas (original) (raw)

Right:

$ python -c 'import pandas; print pandas.Series([1, 2, None, 1, 1, 3, None, 3]).value_counts(dropna = False)'
 1     3
 3     2
NaN    2
 2     1
dtype: int64

Wrong, because there is no row for NaN:

$ python -c 'import pandas; print pandas.Series([1, 2, None, 1, 1, 3, None, 3], dtype = "category").value_counts(dropna = False)'
1    3
3    2
2    1
dtype: int64

pandas.show_versions() yields:

commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-30-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.15.2
nose: 1.3.4
Cython: 0.18
numpy: 1.9.1
scipy: 0.14.0
statsmodels: 0.5.0
IPython: 2.3.0
sphinx: None
patsy: 0.2.1
dateutil: 2.4.0
pytz: 2014.10
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.4.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.9
apiclient: None
rpy2: 2.4.2
sqlalchemy: None
pymysql: None
psycopg2: None