Pandas provide a unique method for extracting strings from a data frame.
Dataframe.iloc† is used when the data frame index label is something other than the numeric series 0, 1, 2, 3… .n or if the user does not know the label index. Rows can be retrieved using an imaginary index position that is not visible in the dataframe.
Syntax: pandas.DataFrame.iloc [
Index Position: Index position of rows in integer or list of integer.
Return type: b > Data frame or Series depending on parameters
To download the CSV used in the code, click here.
Example # 1: Extract one line and compare with .loc 
This example is the same the ordinal string is retrieved by both the .iloc  and .loc  methods and compared. Since the index column is numeric by default, hence the index label will also be an integer.
As shown in the output image, the results returned by both methods are the same.
Example # 2: Extracting multiple lines with index
This example retrieves multiple strings by first passing in a list and then passing in integers to extract the strings between that range. Then both values are compared.
As shown in the output image, the results returned by both methods are the same. All values are true except for the college column since they were NaN values.