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
data.loc( ) Access a group of rows and columns by labels.
This selcet a certain column within a row.
data.illoc( ) Access a group of rows and columns by integer position. Illoc is used to select row by index.