Returns all the records as a list of Row
# Returns all the records as a list of Row df.collect() # [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
Here is what the above code is Doing:
1. We create a DataFrame from a Python list of tuples.
2. We call the show() method to print the DataFrame.
3. We call the collect() method to return a list that contains all of the rows in this DataFrame.