- PySpark Cookbook
- Denny Lee Tomasz Drabas
- 91字
- 2021-06-18 19:06:40
.collect() action
We have also cautioned you about using this action; collect() returns all of the elements from the workers to the driver. Thus, look at the following code:
# Return all airports elements
# filtered by WA state
airports.filter(lambda c: c[1] == "WA").collect()
This will generate the following output:
# Output
[[u'Bellingham', u'WA', u'USA', u'BLI'], [u'Moses Lake', u'WA', u'USA', u'MWH'], [u'Pasco', u'WA', u'USA', u'PSC'], [u'Pullman', u'WA', u'USA', u'PUW'], [u'Seattle', u'WA', u'USA', u'SEA'], [u'Spokane', u'WA', u'USA', u'GEG'], [u'Walla Walla', u'WA', u'USA', u'ALW'], [u'Wenatchee', u'WA', u'USA', u'EAT'], [u'Yakima', u'WA', u'USA', u'YKM']]
推薦閱讀
- Kubernetes實戰
- Building a RESTful Web Service with Spring
- Interactive Data Visualization with Python
- JMeter 性能測試實戰(第2版)
- Creating Stunning Dashboards with QlikView
- Raspberry Pi Robotic Blueprints
- Visual Basic程序設計(第三版)
- Advanced Python Programming
- iOS Development with Xamarin Cookbook
- Mastering XenApp?
- Ubuntu Server Cookbook
- Three.js Essentials
- Learning PrimeFaces Extensions Development
- 威脅建模:設計和交付更安全的軟件
- 軟件工程實用教程 (第3版)