From 24773bd6a2e74ab6393a2aaa2ef7f70633fdcc89 Mon Sep 17 00:00:00 2001 From: Cecilia Date: Wed, 6 Feb 2019 03:12:23 +0000 Subject: [PATCH] DOC: update docstring for series.nunique (#25116) --- pandas/core/base.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pandas/core/base.py b/pandas/core/base.py index 7b3152595e4b24..24695dd4cfd9c8 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -1323,12 +1323,31 @@ def nunique(self, dropna=True): Parameters ---------- - dropna : boolean, default True + dropna : bool, default True Don't include NaN in the count. Returns ------- - nunique : int + int + + See Also + -------- + DataFrame.nunique: Method nunique for DataFrame. + Series.count: Count non-NA/null observations in the Series. + + Examples + -------- + >>> s = pd.Series([1, 3, 5, 7, 7]) + >>> s + 0 1 + 1 3 + 2 5 + 3 7 + 4 7 + dtype: int64 + + >>> s.nunique() + 4 """ uniqs = self.unique() n = len(uniqs)