This post introduces the differences among iloc, ix, and loc.
Note: in pandas version > = 0.20.0, ix
is deprecated . Thus, useloc
and iloc
instead.
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).ix
— usually behaves likeloc
but falls back to behaving likeiloc
if a label is not present in the index.
References: