- PySpark Cookbook
- Denny Lee Tomasz Drabas
- 61字
- 2021-06-18 19:06:38
.distinct() transformation
The distinct() transformation returns a new RDD containing the distinct elements of the source RDD. So, look at the following code snippet:
# Provide the distinct elements for the
# third column of airports representing
# countries
(
airports
.map(lambda c: c[2])
.distinct()
.take(5)
)
This will return the following output:
# Output
[u'Canada', u'USA', u'Country']
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動(dòng)畫與游戲編程
- Angular UI Development with PrimeNG
- RTC程序設(shè)計(jì):實(shí)時(shí)音視頻權(quán)威指南
- Rust Cookbook
- Apache Karaf Cookbook
- Java程序設(shè)計(jì)
- Python算法詳解
- Learning Apache Cassandra
- 智能手機(jī)APP UI設(shè)計(jì)與應(yīng)用任務(wù)教程
- Beginning C++ Game Programming
- 多模態(tài)數(shù)據(jù)分析:AGI時(shí)代的數(shù)據(jù)分析方法與實(shí)踐
- 深入解析Java編譯器:源碼剖析與實(shí)例詳解
- Web開發(fā)新體驗(yàn)
- INSTANT EaselJS Starter
- Learning GraphQL and Relay