Lecture 17 – Applying

Data 6, Summer 2021

Motivation

Apply

Note, we wouldn't actually use the above example since we could just write pups.column('age') * 7.

Here's a more useful example:

Quick Check 1

Look at the very last row of the output – that gross income doesn't look right.

It's because the entries in the 'gross' column are strings, not integers.

Your job is to fix that!

Example: end-of-semester grading

What if we want to factor in grading options?

Masking

Example: countries

Run the following cell – ignore the lambda parts: