
上QQ阅读APP看书,第一时间看更新
.take(...) action
We have already discussed this, but, for the sake of completeness, the take(n) action returns an array with the first n elements of the RDD. Look at the following code:
# Print to console the first 3 elements of
# the airports RDD
airports.take(3)
This will generate the following output:
# Output
[[u'City', u'State', u'Country', u'IATA'],
[u'Abbotsford', u'BC', u'Canada', u'YXX'],
[u'Aberdeen', u'SD', u'USA', u'ABR']]