Picking Rows and Columns: loc and iloc

Square brackets pick columns by name, set_index makes a column such as sku the row labels, loc picks rows and columns by those labels (a label slice includes its end), and iloc picks them by position, counting from 0 (a position slice stops before its end).

By

Updated

Cheat sheet: Picking Rows and Columns: loc and iloc
Category
Data Analysis
Level
Apprentice
Tags
iloc, loc, python, set_index(), Slicing