Skip to content

Commit efa23ca

Browse files
cecilialiaojreback
authored andcommitted
DOC: update docstring for series.nunique (#25116)
1 parent 9cac5a9 commit efa23ca

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

pandas/core/base.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -1323,12 +1323,31 @@ def nunique(self, dropna=True):
13231323
13241324
Parameters
13251325
----------
1326-
dropna : boolean, default True
1326+
dropna : bool, default True
13271327
Don't include NaN in the count.
13281328
13291329
Returns
13301330
-------
1331-
nunique : int
1331+
int
1332+
1333+
See Also
1334+
--------
1335+
DataFrame.nunique: Method nunique for DataFrame.
1336+
Series.count: Count non-NA/null observations in the Series.
1337+
1338+
Examples
1339+
--------
1340+
>>> s = pd.Series([1, 3, 5, 7, 7])
1341+
>>> s
1342+
0 1
1343+
1 3
1344+
2 5
1345+
3 7
1346+
4 7
1347+
dtype: int64
1348+
1349+
>>> s.nunique()
1350+
4
13321351
"""
13331352
uniqs = self.unique()
13341353
n = len(uniqs)

0 commit comments

Comments
 (0)