Skip to content

Feature request: DataFrame.mode(dropna=False) #17534

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

Closed
fulldecent opened this issue Sep 14, 2017 · 2 comments · Fixed by #20779
Closed

Feature request: DataFrame.mode(dropna=False) #17534

fulldecent opened this issue Sep 14, 2017 · 2 comments · Fixed by #20779
Milestone

Comments

@fulldecent
Copy link

fulldecent commented Sep 14, 2017

Code Sample, a copy-pastable example if possible

Current:

df = pd.DataFrame({'A': [1, 2, np.nan, np.nan, np.nan]})
df.mode()
     A
0  1.0
1  2.0

Proposed:

df = pd.DataFrame({'A': [1, 2, np.nan, np.nan, np.nan]})
df.mode(dropna=False)
     A
0   NA

Problem description

Current behavior is inconsistent with value_counts() because that allows value_counts(dropna=False).

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Darwin
OS-release: 16.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.20.3
pytest: None
pip: 9.0.1
setuptools: 32.2.0
Cython: None
numpy: 1.13.1
scipy: 0.19.1
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger
Copy link
Contributor

Seems reasonable. Are you interested in submitting a PR for it?

fulldecent added a commit to fulldecent/pandas that referenced this issue Sep 15, 2017
@fulldecent
Copy link
Author

Well here's what I have so far #17547

fulldecent added a commit to fulldecent/pandas that referenced this issue Oct 31, 2017
reidy-p added a commit to reidy-p/pandas that referenced this issue Apr 20, 2018
reidy-p added a commit to reidy-p/pandas that referenced this issue Apr 21, 2018
@jreback jreback added this to the Next Major Release milestone Apr 21, 2018
@jreback jreback modified the milestones: Next Major Release, 0.24.0 May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants