Pandas Exercises

Pandas lesson page

Solutions

Setup

Download the csv file CountyHealthData_2014-2015.csv.

Exercises

1. What are the 5 states with the highest average adult smoking rates? Show the states and their smoking rates.

2. Food Environment Index (FEI) measures access to food and food insecurity (0 is bad, 10 is good). According to countyhealthrankings.org, "In 2019, the average FEI value for counties was 7.5 and most counties fell between about 6.9 and 8.2." (Caveat: our data is from 2014-2015)

3. In many counties one can find more primary care physicians than dentists. However, in a few counties there are more than 5 times (!) as many dentists as there are primary care physicians.

4. Create a dataframe (again, use .copy()) that only includes counties in the state of North Carolina. (Hint: use the Rhode Island example from "Indexing" section to select the values for a single state)

5. The "Some college" column denotes the percantage of the population that have taken any number of college classes.