Skip to content

Commit 17e2ea3

Browse files
Merge pull request #7483 from jorisvandenbossche/fix-doxstring-valuecounts
DOC: fix docstring of value_counts/nunique dropna argument after GH7424
2 parents 71b7087 + 1746beb commit 17e2ea3

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

pandas/core/algorithms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def factorize(values, sort=False, order=None, na_sentinel=-1):
170170
def value_counts(values, sort=True, ascending=False, normalize=False,
171171
bins=None, dropna=True):
172172
"""
173-
Compute a histogram of the counts of non-null values
173+
Compute a histogram of the counts of non-null values.
174174
175175
Parameters
176176
----------
@@ -184,7 +184,7 @@ def value_counts(values, sort=True, ascending=False, normalize=False,
184184
bins : integer, optional
185185
Rather than count values, group them into half-open bins,
186186
convenience for pd.cut, only works with numeric data
187-
dropna : boolean, default False
187+
dropna : boolean, default True
188188
Don't include counts of NaN
189189
190190
Returns

pandas/core/base.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,11 @@ def min(self):
248248
def value_counts(self, normalize=False, sort=True, ascending=False,
249249
bins=None, dropna=True):
250250
"""
251-
Returns object containing counts of unique values. The resulting object
252-
will be in descending order so that the first element is the most
253-
frequently-occurring element. Excludes NA values.
251+
Returns object containing counts of unique values.
252+
253+
The resulting object will be in descending order so that the
254+
first element is the most frequently-occurring element.
255+
Excludes NA values by default.
254256
255257
Parameters
256258
----------
@@ -264,8 +266,8 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
264266
bins : integer, optional
265267
Rather than count values, group them into half-open bins,
266268
a convenience for pd.cut, only works with numeric data
267-
dropna : boolean, default False
268-
Don't include counts of NaN
269+
dropna : boolean, default True
270+
Don't include counts of NaN.
269271
270272
Returns
271273
-------
@@ -289,7 +291,14 @@ def unique(self):
289291

290292
def nunique(self, dropna=True):
291293
"""
292-
Return count of unique elements in the object. Excludes NA values.
294+
Return number of unique elements in the object.
295+
296+
Excludes NA values by default.
297+
298+
Parameters
299+
----------
300+
dropna : boolean, default True
301+
Don't include NaN in the count.
293302
294303
Returns
295304
-------

0 commit comments

Comments
 (0)