本文简要介绍
pyspark.pandas.Index.unique
的用法。用法:
Index.unique(level: Union[int, Any, Tuple[Any, …], None] = None) → pyspark.pandas.indexes.base.Index
返回索引中的唯一值。
请注意,唯一值的顺序可能与 pandas.Index.unique 不同
- level:int 或 str,可选,默认为 None
- 无重复索引
参数:
返回:
例子:
>>> ps.DataFrame({'a': ['a', 'b', 'c']}, index=[1, 1, 3]).index.unique().sort_values() Int64Index([1, 3], dtype='int64')
>>> ps.DataFrame({'a': ['a', 'b', 'c']}, index=['d', 'e', 'e']).index.unique().sort_values() Index(['d', 'e'], dtype='object')
MultiIndex
>>> ps.MultiIndex.from_tuples([("A", "X"), ("A", "Y"), ("A", "X")]).unique() ... MultiIndex([('A', 'X'), ('A', 'Y')], )
相关用法
- Python pyspark Index.union用法及代码示例
- Python pyspark Index.is_monotonic_decreasing用法及代码示例
- Python pyspark Index.values用法及代码示例
- Python pyspark Index.drop_duplicates用法及代码示例
- Python pyspark Index.value_counts用法及代码示例
- Python pyspark Index.map用法及代码示例
- Python pyspark Index.equals用法及代码示例
- Python pyspark Index.argmin用法及代码示例
- Python pyspark Index.argmax用法及代码示例
- Python pyspark Index.item用法及代码示例
- Python pyspark Index.insert用法及代码示例
- Python pyspark Index.nlevels用法及代码示例
- Python pyspark Index.min用法及代码示例
- Python pyspark Index.copy用法及代码示例
- Python pyspark Index.difference用法及代码示例
- Python pyspark Index.to_list用法及代码示例
- Python pyspark Index.shape用法及代码示例
- Python pyspark Index.dropna用法及代码示例
- Python pyspark Index.repeat用法及代码示例
- Python pyspark Index.notna用法及代码示例
- Python pyspark Index.has_duplicates用法及代码示例
- Python pyspark Index.max用法及代码示例
- Python pyspark Index.astype用法及代码示例
- Python pyspark Index.to_frame用法及代码示例
- Python pyspark Index.any用法及代码示例
注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 pyspark.pandas.Index.unique。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。