Plotting With Pandas

Plotting With Pandas#

This chapter covers how to generate matplotlib plots for data stored in a pandas DataFrame. It provides an overview of how to generate a variety of common plot types, including line plots, bar charts, histograms, box plots, area plots, scatter plots, and pie charts. It also covers how pandas’s plotting function handles missing data.

It provides a comparison of the matplotlib and seaborn plotting packages and provides an introduction to seaborn with sample code.

Acknowledgements#

The author consulted the following resources when writing this tutorial:

Chapter Contents#

Data#

This chapter uses a few different datasets:

  • Air quality data

    • Code to load from URL is included

  • City of South Bend budget data

    • Code to load/process this data is included

  • We’ll also use some data generated randomly with numpy. Code to generate random data is included.

  • The seaborn section of the chapter uses sample datasets that are included in the library.

    • tips

    • dots

Application#

Click here for a Jupyter Notebook template for this chapter’s application problems.