Select rows from 0 to 2 and columns from 0 to 1
Here, we are selecting the first second third rows, and the first and second columns using iloc[0:3].
Python3
# selecting rows from 0 to # 2 and columns 0 to 1 df.iloc[ 0 : 3 , 0 : 2 ] |
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.