Exercise

# pandas hist, pdf and cdf

Pandas relies on the `.hist()`

method to not only generate histograms, but also plots of probability density functions (PDFs) and cumulative density functions (CDFs).

In this exercise, you will work with a dataset consisting of restaurant bills that includes the amount customers tipped.

The original dataset is provided by the Seaborn package.

Your job is to plot a PDF and CDF for the `fraction`

column of the tips dataset. This column contains information about what fraction of the total bill is comprised of the tip.

Remember, when plotting the PDF, you need to specify `normed=True`

in your call to `.hist()`

, and when plotting the CDF, you need to specify `cumulative=True`

in addition to `normed=True`

.

All necessary modules have been imported and the tips dataset is available in the workspace as `df`

. Also, some formatting code has been written so that the plots you generate will appear on separate rows.

Instructions

**100 XP**

- Plot a PDF for the values in
`fraction`

with 30`bins`

between 0 and 30%. The range has been taken care of for you.`ax=axes[0]`

means that this plot will appear in the first row. - Plot a CDF for the values in
`fraction`

with 30`bins`

between 0 and 30%. Again, the range has been specified for you. To make the CDF appear on the second row, you need to specify`ax=axes[1]`

.