Reminder: We currently have a dataframe called
measurements and it looks like this:
To get all available column names, run
We can extract a singular column by using the
Note that the output is a series again
To access a selection of columns, we pass in a list of column names in the desired order
To access given rows you can use the slicing operation as known from lists:
If you pass in a singular number instead of
[start:stop] pandas will look for a row with that number as a label.
This will fail in our example since the rows are not numbered.
loc gives label-based access to the elements of a dataframe.
It follows the pattern
iloc-property works similar to
loc, except that it takes integer-based indexes instead of row/column labels:
Output same as above
- Rows and columns can be selected ba their label, with the