本文簡要介紹
pyspark.pandas.Index.union
的用法。用法:
Index.union(other: Union[pyspark.pandas.frame.DataFrame, pyspark.pandas.series.Series, Index, List], sort: Optional[bool] = None) → pyspark.pandas.indexes.base.Index
形成兩個索引對象的並集。
- other:索引或類似數組
- sort:布爾或無,默認無
是否對結果索引進行排序。
- union: index
參數:
返回:
例子:
index
>>> idx1 = ps.Index([1, 2, 3, 4]) >>> idx2 = ps.Index([3, 4, 5, 6]) >>> idx1.union(idx2).sort_values() Int64Index([1, 2, 3, 4, 5, 6], dtype='int64')
MultiIndex
>>> midx1 = ps.MultiIndex.from_tuples([("x", "a"), ("x", "b"), ("x", "c"), ("x", "d")]) >>> midx2 = ps.MultiIndex.from_tuples([("x", "c"), ("x", "d"), ("x", "e"), ("x", "f")]) >>> midx1.union(midx2).sort_values() MultiIndex([('x', 'a'), ('x', 'b'), ('x', 'c'), ('x', 'd'), ('x', 'e'), ('x', 'f')], )
相關用法
- Python pyspark Index.unique用法及代碼示例
- 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.union。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。