pandas · Lesson 3.2 · Pro

Conditional columns

Label rows by rules: np.where for two choices, np.select for several, and pd.cut for number ranges.

In this lesson

  1. Two choices: np.where
  2. Several choices: np.select
  3. Number ranges: pd.cut
  4. Equal-sized groups: pd.qcut