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
- Two choices: np.where
- Several choices: np.select
- Number ranges: pd.cut
- Equal-sized groups: pd.qcut
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.