pandas.Index.nunique
pandas 3.1.1 · Index objects · method
Count distinct values. Set dropna=False to count missing values where supported.
Call syntax
Index.nunique(dropna=True)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
dropna |
Optional Positional or keyword Default True |
bool Choose whether to drop missing values or missing keys from consideration. |
Returns
int