Back to search

loc vs iloc in pandas

`loc` selects by labels and `iloc` selects by integer position.

Pandas Easy Theory

loc vs iloc in pandas

`loc` selects by labels and `iloc` selects by integer position.

  • loc uses labels
  • iloc uses zero-based positions
  • Slices behave differently for labels vs positions

loc vs iloc in pandas