Discussion Forum | Board Infinity

Difference between loc and iloc function

Loc and iloc function

loc gets rows (or columns) with particular labels from the index.
iloc gets rows (or columns) at particular positions in the index (so it only takes integers).
Iloc is the operation of finding index while loc is the operation of finding the element

For Example

As iloc is having the rowth index i.e 1 so choosing 4 name row and giving the result (5,10)
And in loc, it searches for element 1 in rows index and gave us the value (2,4)

1 Like