From 1e496d014b595edf93ae0d8e41627ae326d2724c Mon Sep 17 00:00:00 2001 From: Cecilia Date: Sun, 3 Feb 2019 15:03:04 +0000 Subject: [PATCH 1/2] update docstring for series.nunique --- 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 7b3152595e4b2..0af30af337d5e 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) From 0a4bc5063dbd582b386a6d42203f7902d7a0b25c Mon Sep 17 00:00:00 2001 From: Cecilia Date: Sun, 3 Feb 2019 17:01:22 +0000 Subject: [PATCH 2/2] fixed spaces after commas in list --- pandas/core/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/base.py b/pandas/core/base.py index 0af30af337d5e..24695dd4cfd9c 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -1337,7 +1337,7 @@ def nunique(self, dropna=True): Examples -------- - >>> s = pd.Series([1,3,5,7,7]) + >>> s = pd.Series([1, 3, 5, 7, 7]) >>> s 0 1 1 3