1. Learn
  2. /
  3. Courses
  4. /
  5. Exploring and Analyzing Data in Python

Exercise

Comparing PDFs

In the previous exercise, we used CDFs to see if the distribution of income is lognormal. We can make the same comparison using a PDF and KDE. That's what you'll do in this exercise!

As before, the norm object dist is available in your workspace:

from scipy.stats import norm
dist = norm(mean, std)

Just as all norm objects have a .cdf() method, they also have a .pdf() method.

To create a KDE plot, you can use Seaborn's kdeplot() function. Here, Seaborn has been imported for you as sns.

Instructions

100 XP
  • Evaluate the normal PDF using dist, which is a norm object with the same mean and standard deviation as the data.
  • Make a KDE plot of the logarithms of the incomes, using log_income, which is a Series object.