Lecture 10 / Lab 3

Announcements:

Goals:

apply: for when you can't find the function that does the thing

I literally can't think of a good example right now, so here's a bad one. I want to add a new column and sort by the nubmer of appearances per year:

Why was that a bad example? Because there's a better way:

groupby: a split-apply-combine multitool

This is way more powerful than what I'll show you here, but this is the basics. There's a very extensive section of the user guide devoted to just this function - check it out here: https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html