How it works...

After reading in our data in step 1 and calculating columns for delayed and on-time flights, we are ready to begin making univariate plots. The call to the subplots function in step 3 creates a 2 x 3 grid of equal-sized Axes. We unpack each Axes into its own variable to reference it. Each of the calls to the plot method references the specific Axes in the Figure with the ax parameter. The value_counts method is used to create the three Series that form the plots in the top row. The rot parameter rotates the tick labels to the given angle.

The plot in the bottom left-hand corner uses a logarithmic scale for the y axis, as the number of on-time flights is about two orders of magnitude greater than the number of cancelled flights. ...

Get Pandas Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.