Integer-oriented indexing can be implemented for the same four cases as label-oriented indexing: single labels, a list of labels, range slicing, and Boolean arrays.
Let's use the same DataFrames as in the previous session to understand integer-oriented indexing. Here, let's use two values—one for each axis—to examine integer-based indexing. Passing an index for one axis is also permissible. This can also be done with the loc operator by passing in both the row and column labels:
# Indexing with single values.
In: df_loc1.iloc[3, 2]
Out: 18.0
# Indexing with list of indices
df_loc1.iloc[[1, 4], [0, 2, 3]]
Output of iloc for slicing with a list of indices
# Indexing with ranged slicing
df_loc2.iloc[3:,:3]
Output of iloc for ranged slicing
# Indexing with Boolean array
df_loc2.iloc[(df_loc2["Asia"] > 11).values, :]
Output of iloc for slicing with a Boolean array
For Boolean array-based indexing with the iloc operator, the array must be extracted using logical conditions around array values.