Creating charts from aggregated data
The pandas library makes it easy to visualize data in pd.Series
and pd.DataFrame
objects, using the pd.Series.plot
and pd.DataFrame.plot
methods, respectively. In this recipe we are going to start with relatively basic line, bar, area, and pie charts, while also seeing the high-level customization options pandas offers. While, these chart types are simple, using them effectively can be immensely helpful to explore your data, identify trends, and share your research with non-technical associates.
It is important to note that these chart types expect your data to already be aggregated, which our sample data in this recipe will reflect. If you are working with data that is not yet aggregated, you will need to use techniques that you will encounter in Chapter 7, Reshaping DataFrames, and Chapter 8, Group By, or use the techniques shown in the Using Seaborn for advanced plots recipe later in this chapter.
How to do it
Let’s create...