Comparing President Trump's and Obama's approval ratings
Public support of the current President of the United States is a topic that frequently makes it into news headlines and is formally measured through opinion polls. In recent years, there has been a rapid increase in the frequency of these polls and lots of new data rolls in each week. There are many different pollsters that each have their own questions and methodology to capture their data, and thus there exists quite a bit of variability among the data. TheAmerican Presidency Project from the University of California, Santa Barbara, provides an aggregate approval rating down to a single data point each day.
Unlike most of the recipes in this book, the data is not readily available in a CSV file. Often, as a data analyst, you will need to find data on the web, and use a tool that can scrape it into a format that you can then parse through your local workstation.
Getting ready
In this recipe, we will use the read_html
function, which...