Pandas iloc() property allows us to select a row by its index value. Here, the key point is we can also select multiple rows with the help of iloc() property. We can select the specific row using its index value as well as based on a specific column condition.
i in iloc() stands for index. This is also a data selection method but here, we need to pass the proper index as a parameter to select the required row or column. Index is nothing but the integer value ranging from 0 to n-1 which represents the number of rows or columns. We can perform various operations using iloc() property. Inside iloc() property, the index value of the row comes first followed by the number of columns.
Selecting the first row means selecting the index 0. So, we need to pass 0 as an index inside the iloc() property.
To work with Python Pandas, we need to import the pandas library. Below is the syntax,
import pandas as pd
Let us understand with the help of an example.
Output:

need an explanation for this answer? contact us directly to get an explanation for this answer