DataFrame.nunique(self, axis=0, dropna=True)
[source]
Count distinct observations over requested axis.
Return Series with number of distinct observations. Can ignore NaN values.
New in version 0.20.0.
Parameters: |
|
---|---|
Returns: |
|
See also
Series.nunique
DataFrame.count
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [1, 1, 1]}) >>> df.nunique() A 3 B 1 dtype: int64
>>> df.nunique(axis=1) 0 1 1 2 2 2 dtype: int64
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.DataFrame.nunique.html