What is difference between loc and iloc?

The main distinction between loc and iloc is that loc is label-based, meaning that you have to specify rows and columns based on their row and column labels. iloc is integer position-based, so you have to specify rows and columns by their integer position values (0-based integer position)

Example