O'Reilly logo

Practical Data Science Cookbook - Second Edition by Abhijit Dasgupta, Benjamin Bengfort, Sean Patrick Murphy, Tony Ojeda, Prabhanjan Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

Generally speaking, the data for the United States is broken up into six groups:

  • Top 10 percent income share
  • Top 5 percent income share
  • Top 1 percent income share
  • Top 0.5 percent income share
  • Top 0.1 percent income share
  • Average income share

These groups reflect aggregations for data points collected in those specific bins. An easy and quick first analysis is to simply plot these percentages of income shares over time for each of the top income groups. Since plotting several time series is going to be a common task, let's once again create a helper function that wraps matplotlib and generates a line chart for each time series that is passed to it:

In [24]: def linechart(series, **kwargs):     ...: fig = plt.figure()  ...: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required