xorbits.pandas.Series.mode#

Series.mode(dropna: bool = True) pandas.core.series.Series[源代码]#

Return the mode(s) of the Series.

The mode is the value that appears most often. There can be multiple modes.

Always returns Series even if only one value is returned.

参数

dropna (bool, default True) – Don’t consider counts of NaN/NaT.

返回

Modes of the Series in sorted order.

返回类型

Series

实际案例

>>> s = pd.Series([2, 4, 2, 2, 4, None])  
>>> s.mode()  
0    2.0
dtype: float64

More than one mode:

>>> s = pd.Series([2, 4, 8, 2, 4, None])  
>>> s.mode()  
0    2.0
1    4.0
dtype: float64

With and without considering null value:

>>> s = pd.Series([2, 4, None, None, 4, None])  
>>> s.mode(dropna=False)  
0   NaN
dtype: float64
>>> s = pd.Series([2, 4, None, None, 4, None])  
>>> s.mode()  
0    4.0
dtype: float64

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.series.Series.