Python Quest

Track 14 · Lesson 7 of 12

Transforming columns

Derive new columns with vectorised arithmetic, np.where, map, the str accessor and pd.cut, and know when apply is (and isn't) the right tool.

About 45 minIntermediate4 exercises

You will be able to

  • Add a derived column with vectorised arithmetic or assign
  • Choose between two values per row with np.where
  • Translate codes with map and a dictionary, handling unmatched values
  • Split and reshape text with the str accessor
  • Group numbers into labelled bands with pd.cut

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.