本文簡要介紹
pyspark.RDD.intersection
的用法。用法:
RDD.intersection(other)
返回此 RDD 與另一個 RDD 的交集。輸出不會包含任何重複元素,即使輸入 RDD 包含。
注意:
此方法在內部執行Shuffle[洗牌]。
例子:
>>> rdd1 = sc.parallelize([1, 10, 2, 3, 4, 5]) >>> rdd2 = sc.parallelize([1, 6, 2, 3, 7, 8]) >>> rdd1.intersection(rdd2).collect() [1, 2, 3]
相關用法
- Python pyspark RDD.isEmpty用法及代碼示例
- Python pyspark RDD.saveAsTextFile用法及代碼示例
- Python pyspark RDD.keyBy用法及代碼示例
- Python pyspark RDD.sumApprox用法及代碼示例
- Python pyspark RDD.lookup用法及代碼示例
- Python pyspark RDD.zipWithIndex用法及代碼示例
- Python pyspark RDD.sampleByKey用法及代碼示例
- Python pyspark RDD.coalesce用法及代碼示例
- Python pyspark RDD.subtract用法及代碼示例
- Python pyspark RDD.count用法及代碼示例
- Python pyspark RDD.groupWith用法及代碼示例
- Python pyspark RDD.distinct用法及代碼示例
- Python pyspark RDD.treeAggregate用法及代碼示例
- Python pyspark RDD.mapPartitionsWithIndex用法及代碼示例
- Python pyspark RDD.foreachPartition用法及代碼示例
- Python pyspark RDD.zipWithUniqueId用法及代碼示例
- Python pyspark RDD.sortByKey用法及代碼示例
- Python pyspark RDD.takeOrdered用法及代碼示例
- Python pyspark RDD.collectAsMap用法及代碼示例
- Python pyspark RDD.countApproxDistinct用法及代碼示例
- Python pyspark RDD.toLocalIterator用法及代碼示例
- Python pyspark RDD.reduceByKeyLocally用法及代碼示例
- Python pyspark RDD.max用法及代碼示例
- Python pyspark RDD.map用法及代碼示例
- Python pyspark RDD.partitionBy用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 pyspark.RDD.intersection。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。