Lecture 10 Supplemental Notebook

Data 100, Summer 2021

Suraj Rampure, with updates by Fernando Pérez.


Let's now compute the relative change between the two years...

Current Population Survey

Now, let's compute the income gap as a relative quantity between men and women. Recall that the structure of the dataframe is as follows:

This calls for using groupby by Gender, so that we can separate the data for both genders, and then compute the ratio:

Let's now compute the alternate ratio, F/M instead:


Kernel Density Estimates

Let's define some kernels. We will explain these formulas momentarily. We'll also define some helper functions for visualization purposes.

Here are our five points.

Step 1: Place a kernel at each point

We'll start with the Gaussian kernel.