用法:
Index.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.Index.notnull用法及代码示例
- Python pandas.Index.notna用法及代码示例
- Python pandas.Index.value_counts用法及代码示例
- Python pandas.Index.argmin用法及代码示例
- Python pandas.Index.is_categorical用法及代码示例
- Python pandas.Index.to_series用法及代码示例
- Python pandas.Index.str用法及代码示例
- Python pandas.Index.to_numpy用法及代码示例
- Python pandas.Index.is_object用法及代码示例
- Python pandas.Index.slice_indexer用法及代码示例
- Python pandas.Index.is_interval用法及代码示例
- Python pandas.Index.equals用法及代码示例
- Python pandas.Index.set_names用法及代码示例
- Python pandas.Index.searchsorted用法及代码示例
- Python pandas.Index.duplicated用法及代码示例
- Python pandas.Index.is_monotonic_increasing用法及代码示例
- Python pandas.Index.min用法及代码示例
- Python pandas.Index.is_monotonic_decreasing用法及代码示例
- Python pandas.Index.max用法及代码示例
- Python pandas.Index.shift用法及代码示例
注:本文由纯净天空筛选整理自pandas.pydata.org大神的英文原创作品 pandas.Index.nunique。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。