RDD.
first
Return the first element in this RDD.
New in version 0.7.0.
the first element
See also
RDD.take()
pyspark.sql.DataFrame.first()
pyspark.sql.DataFrame.head()
Examples
>>> sc.parallelize([2, 3, 4]).first() 2 >>> sc.parallelize([]).first() Traceback (most recent call last): ... ValueError: RDD is empty
previous
pyspark.RDD.filter
next
pyspark.RDD.flatMap