Difference between loc() and iloc() in Pandas DataFrame

Here are some difference between loc() and iloc():

Label or Integer basedloc() method  is label-based which means we have to specify both the names of rows and columns that we want to filter outwhile iloc() method is integer-based which means we have to just pass the integer index to select specific row/columns.
inclusion of last elementloc() method includes the last elementwhile iloc() method does not include the last element.
Input UsedInput we can use in loc() methods are:
- A string
- A list of strings
- Slice notation using strings as the start and stop values
Input we can use in iloc() methods are:
- An integer
- A list of integers
- Slice notation using integers as the start and stop values
Boolean Data Typeloc() method can accept the boolean datawhile iloc() method does not accept boolean data