Sahaj.blogs

Day page

7 Mar 2024

Study

Pandas · Selection with loc and iloc

Label-based loc versus position-based iloc, boolean filtering, query(), and avoiding chained assignment.

  • loc selects by label and its slices include the end; iloc selects by position and its slices exclude the end.
  • Assign with one df.loc[rows, col] = value call, not chained brackets.

Read the post →