用法:
Series.nunique(dropna=True)
返回對象中唯一元素的數量。
默認情況下排除 NA 值。
- dropna:布爾值,默認為真
不要在計數中包含 NaN。
- int
參數:
返回:
例子:
>>> s = pd.Series([1, 3, 5, 7, 7]) >>> s 0 1 1 3 2 5 3 7 4 7 dtype:int64
>>> s.nunique() 4
相關用法
- Python pandas.Series.nsmallest用法及代碼示例
- Python pandas.Series.notna用法及代碼示例
- Python pandas.Series.name用法及代碼示例
- Python pandas.Series.ne用法及代碼示例
- Python pandas.Series.notnull用法及代碼示例
- Python pandas.Series.nlargest用法及代碼示例
- Python pandas.Series.add_prefix用法及代碼示例
- Python pandas.Series.map用法及代碼示例
- Python pandas.Series.max用法及代碼示例
- Python pandas.Series.str.isdecimal用法及代碼示例
- Python pandas.Series.str.get用法及代碼示例
- Python pandas.Series.to_csv用法及代碼示例
- Python pandas.Series.dt.day_name用法及代碼示例
- Python pandas.Series.sample用法及代碼示例
- Python pandas.Series.head用法及代碼示例
- Python pandas.Series.eq用法及代碼示例
- Python pandas.Series.plot.line用法及代碼示例
- Python pandas.Series.to_pickle用法及代碼示例
- Python pandas.Series.between_time用法及代碼示例
- Python pandas.Series.reindex_like用法及代碼示例
注:本文由純淨天空篩選整理自pandas.pydata.org大神的英文原創作品 pandas.Series.nunique。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。