Core pandas · Lesson 4 of 10

Indexing, selecting and assigning

Getting the data you want

Once you have a DataFrame, you need to pull out the parts you care about.

  • Select one column with square brackets: df["score"]
  • Select rows by position with iloc
  • Select rows by label or by a condition with loc
Python

That last line is the most useful pattern in all of pandas: filtering rows by a condition.

Exercise

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →

Lesson 4 of 10