I have a Pandas Data Frame object that has 1000 rows and 10 columns. I would simply like to slice the Data Frame and take the first 10 rows. How can I do this? I\'ve been tr
I can see at least three options:
1.
df[:10]
2. Using head
df.head(10)
For negative values of n, this function returns all rows except the last n rows, equivalent to df[:-n] [Source].
df[:-n]
3. Using iloc
df.iloc[:10]