Selecting 0, 1, 2 rows.
Here, we are selecting the first second, and third rows using iloc[0:3], starting with 0 indexes and ending with (3-1=2) index.
Python3
# select 0, 1, 2 rows #from the dataframe df.iloc[ 0 : 3 ] |
Output:
Select a row of series or dataframe by given integer index
The Dataframe.iloc[] is used to select a row of Series/Dataframe by a given integer index in Python.