pandas.DataFrame.nunique
pandas 3.1.1 · DataFrame · method
Count distinct values. Set dropna=False to count missing values where supported.
Call syntax
DataFrame.nunique(axis=0, dropna=True)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
axis |
Optional Positional or keyword Default 0 |
{0 or 'index', 1 or 'columns'} Choose which axis the operation acts on. The accepted axis labels depend on the receiver. |
dropna |
Optional Positional or keyword Default True |
bool Choose whether to drop missing values or missing keys from consideration. |
Returns
Series