The DataFrame.iloc is used when the index label of the DataFrame is other than numeric series of 0,1,2,....,n or in the case when the user does not know the index label.
We can extract the rows by using an imaginary index position which is not visible in the DataFrame. It is an integer- based position(from 0 to length-1 of the axis), but may also be used with the boolean array.
The allowed inputs for .loc are:
It can raise the IndexError if we request the index is out-of-bounds, except slice indexers, which allow the out-of-bounds indexing.
It returns the DataFrame or the Series.
a1 b2 c 3 d4 Name: 0, dtype: int64