Skip to content

DOC: fix docstring of value_counts/nunique dropna argument after GH7424 #7483

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def factorize(values, sort=False, order=None, na_sentinel=-1):
def value_counts(values, sort=True, ascending=False, normalize=False,
bins=None, dropna=True):
"""
Compute a histogram of the counts of non-null values
Compute a histogram of the counts of non-null values.

Parameters
----------
Expand All @@ -184,7 +184,7 @@ def value_counts(values, sort=True, ascending=False, normalize=False,
bins : integer, optional
Rather than count values, group them into half-open bins,
convenience for pd.cut, only works with numeric data
dropna : boolean, default False
dropna : boolean, default True
Don't include counts of NaN

Returns
Expand Down
21 changes: 15 additions & 6 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ def min(self):
def value_counts(self, normalize=False, sort=True, ascending=False,
bins=None, dropna=True):
"""
Returns object containing counts of unique values. The resulting object
will be in descending order so that the first element is the most
frequently-occurring element. Excludes NA values.
Returns object containing counts of unique values.

The resulting object will be in descending order so that the
first element is the most frequently-occurring element.
Excludes NA values by default.

Parameters
----------
Expand All @@ -263,8 +265,8 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
bins : integer, optional
Rather than count values, group them into half-open bins,
a convenience for pd.cut, only works with numeric data
dropna : boolean, default False
Don't include counts of NaN
dropna : boolean, default True
Don't include counts of NaN.

Returns
-------
Expand All @@ -288,7 +290,14 @@ def unique(self):

def nunique(self, dropna=True):
"""
Return count of unique elements in the object. Excludes NA values.
Return number of unique elements in the object.

Excludes NA values by default.

Parameters
----------
dropna : boolean, default True
Don't include NaN in the count.

Returns
-------
Expand Down