Skip to content

Commit 1746beb

Browse files
DOC: fix docstring of value_counts/nunique dropna argument after GH7424
1 parent f1c5386 commit 1746beb

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
@@ -247,9 +247,11 @@ def min(self):
247247
def value_counts(self, normalize=False, sort=True, ascending=False,
248248
bins=None, dropna=True):
249249
"""
250-
Returns object containing counts of unique values. The resulting object
251-
will be in descending order so that the first element is the most
252-
frequently-occurring element. Excludes NA values.
250+
Returns object containing counts of unique values.
251+
252+
The resulting object will be in descending order so that the
253+
first element is the most frequently-occurring element.
254+
Excludes NA values by default.
253255
254256
Parameters
255257
----------
@@ -263,8 +265,8 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
263265
bins : integer, optional
264266
Rather than count values, group them into half-open bins,
265267
a convenience for pd.cut, only works with numeric data
266-
dropna : boolean, default False
267-
Don't include counts of NaN
268+
dropna : boolean, default True
269+
Don't include counts of NaN.
268270
269271
Returns
270272
-------
@@ -288,7 +290,14 @@ def unique(self):
288290

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

0 commit comments

Comments
 (0)