Pandas .loc: Selecting rows, columns, and slices by label

Pandas .loc: Selecting rows, columns, and slices by label

Retrieve from a Python Pandas data frame with .loc, which takes 2 arguments:

1. Row selector: index, list of indexes, or a mask index (i.e., booleans)
2. Optional column selector: column name or a list of column names

.loc uses [] and not (), so you can use slices!