Apply and Map
When no built-in does what you need, write a small function and use .apply(func) to run it on every value of a column. .map({...}) swaps values using a dictionary. For simple arithmetic, prefer vectorised columns (df['a'] * 2); they are faster and shorter.
Examplepython
Quick check
What does `.map({'A': 4, 'F': 0})` do to a column?
Your turn: write the code
Add a 'passed' column that is True when the mark is 50 or more (use apply with a lambda) and print the column.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.