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...

With the following steps, we will dive deeper into the dataset and examine additional income figures:

  1. The dataset also contains the average incomes by year of the different groups. Let's graph these and see how they have changed over time, relative to each other:
In [32]: def average_incomes(source):     ...: """     ...: Compares percentage average incomes     ...: """     ...: columns = (     ...: "Top 10% average income",     ...: "Top 5% average income",     ...: "Top 1% average income",     ...: "Top 0.5% average income",     ...: "Top 0.1% average income",     ...: "Top 0.05% average income",     ...: )     ...: source = list(dataset(source))     ...: return linechart([timeseries(source, col) for col in      ...: columns], labels=columns, ,  ...: ylabel="2008 ...

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