Indexing by Name
Learn about indexing by name in DataFrames.
We'll cover the following...
Let’s explore indexing by the name of index entries in a DataFrame. This is done by indexing on loc
. If you’re confused between loc
and iloc
, just remember that iloc
indexes on position and that computer programs generally use the variable i
to represent an index position.
One thing to be aware of is the difference between iloc
and loc
when dealing with integer indexes. In particular, slicing has different behavior. Slicing with iloc
follows the half-open interval (includes the first ...