first five rows of dataframe python code example
Example 1: head pandas python
# Returns the first 5 rows
df.head(n=5)
Example 2: Returns the first n rows
# Returns the first n rows
df.head()
# Row(age=2, name=u'Alicz')
df.head(1)
# [Row(age=2, name=u'Alice')]