xorbits.pandas.DataFrame.nunique#

DataFrame.nunique(axis: Union[int, str] = 0, dropna: bool = True, method: str = 'auto', combine_size: Optional[int] = None)#

Count number of distinct elements in specified axis.

Return Series with number of distinct elements. Can ignore NaN values.

Parameters
  • axis ({0 or 'index', 1 or 'columns'}, default 0) – The axis to use. 0 or ‘index’ for row-wise, 1 or ‘columns’ for column-wise.

  • dropna (bool, default True) – Don’t include NaN in the counts.

Return type

Series

See also

Series.nunique

Method nunique for Series.

DataFrame.count

Count non-NA cells for each column or row.

Examples

>>> df = pd.DataFrame({'A': [4, 5, 6], 'B': [4, 1, 1]})  
>>> df.nunique()  
A    3
B    2
dtype: int64
>>> df.nunique(axis=1)  
0    1
1    2
2    2
dtype: int64
methodstr, default ‘auto’

execute via tree or shuffle way.

combine_sizeint, default None

combine chunk sizes when executing via tree way.

This docstring was copied from pandas.core.frame.DataFrame.