Advertisement

New Jobs Analysis with Python

By on

Click here to learn more about author Steve Miller.

The presidential race is heating up as primaries come to an end. And if it’s Trump vs Clinton, there’ll be no shortage of strong opinion among the electorate as to which offers the best policies for economics, defense, energy, health care, etc.

Last year I posted a series of blogs on Dataversity pertaining to the “economic” performance of presidents over the last seventy years. Part of my motivation was to have fun with my “red” neighborhood friends who claim they always outperform blue and that the Reagan era represented the height of U.S. history.

For the earlier blogs, I downloaded several spreadsheets with time series data on jobs, unemployment, and gdp from the St Louis Fed. I then constructed in R a datatable with the relevant data embellished by indicators of the president and party in power for each monthly data point. Finally, I computed and displayed summary statistics by president and party.

A few weeks back, a neighborhood kid studying python asked if I’d share the blog-supporting Jupyter notebook with him. He’d been reminded of my work when he recently found a Fact Check Article summarizing a much more comprehensive analysis than mine. His thinking was that understanding the computation behind the analytics would advance his learning of python.

Alas, my analysis had used R rather than python, so I spent an evening assembling a python notebook on some of the calculations. I then gave it to him with the assignment of finishing the “undone” R code in python. He did a great job. “Study Results?” Though blue appear to “trump” red, I conclude very little importance from these analytics. The remainder of the article oulines my evening of python work.

As for the code:

Image-1-SM-blog-June

Image-2-SM-blog-June

Image-3-SM-blog-June

Image-4-SM-blog-June

Image-5-SM-blog-June

Image-6-SM-blog-June

Image-7-SM-blog-June

Image-7a-SM-blog-June

 

Leave a Reply