Data Viz: US State Population Animation

Anthony Jimenez
20 August 2021

Overview of this work

With data visualization becoming more and more important in order to share results and help give meaning to certain projects, this notebook will leverage the plotly library for animation chart generation.

Main Data Sources:

With US Census data being provided every 10 years, a simple numpy library function (np.interp()) will be used to linearly interpolate between the provided data points to give more density when generating our animation bar chart.

Finally, before plotting, we will generate a function that will allow us to filter our dataframe to show only the top 10 US State Populations for each given year.

Import necessary libraries

Load each excel worksheet into different dataframes

Combine all dataframes into single one for analysis

Create multi-index dataframe that is grouped by 'State' and 'Year'

Main functions for interpolating and returning the top "X" states

Main call to the functions to generate a dense population dataframe

Leveraging the plotly library for animation plots