Part 2 Next Set Questions Using Census Data United States Census Bureau Counties Political Q43809173(1)
use phyton
Part 2 For the next set of questions, we will be using census data from the United States Census Bureau. Counties are political and geographic subdivisions of states in the United States. This dataset contains population data for counties and states in the US from 2010 to 2015. See this document for a description of the variable names. The census dataset (census.csv) should be loaded as census_df. Answer questions using this as appropriate. Task 5 Which state has the most counties in it? (hint: consider the sumlevel key carefully! You’ll need this for future questions too…) This function should return a single string value. Task 6 Only looking at the three most populous counties for each state, what are the three most populous states in order of highest population to lowest population)? Use CENSUS2010POP. This function should return a list of string values. Task 7 Which county has had the largest absolute change in population within the period 2010-2015? (Hint: population values are stored in columns POPESTIMATE2010 through POPESTIMATE2015, you need to consider all six columns.) e.g. If County Population in the 5 year period is 100, 120, 80, 105, 100, 130, then its largest change in the period would be 130-80 = 50. This function should return a single string value. Task 8 In this datafile, the United States is broken up into four regions using the “REGION” column. Create a query that finds the counties that belong to regions 1 or 2, whose name starts with ‘Washington’, and whose POPESTIMATE2015 was greater than their POPESTIMATE 2014. This function should return a 5×2 DataFrame with the columns = (‘STNAME’, CTYNAME’) and the same index ID as the census_df (sorted ascending by index). Show transcribed image text Part 2 For the next set of questions, we will be using census data from the United States Census Bureau. Counties are political and geographic subdivisions of states in the United States. This dataset contains population data for counties and states in the US from 2010 to 2015. See this document for a description of the variable names. The census dataset (census.csv) should be loaded as census_df. Answer questions using this as appropriate. Task 5 Which state has the most counties in it? (hint: consider the sumlevel key carefully! You’ll need this for future questions too…) This function should return a single string value. Task 6 Only looking at the three most populous counties for each state, what are the three most populous states in order of highest population to lowest population)? Use CENSUS2010POP. This function should return a list of string values. Task 7 Which county has had the largest absolute change in population within the period 2010-2015? (Hint: population values are stored in columns POPESTIMATE2010 through POPESTIMATE2015, you need to consider all six columns.) e.g. If County Population in the 5 year period is 100, 120, 80, 105, 100, 130, then its largest change in the period would be 130-80 = 50. This function should return a single string value. Task 8 In this datafile, the United States is broken up into four regions using the “REGION” column. Create a query that finds the counties that belong to regions 1 or 2, whose name starts with ‘Washington’, and whose POPESTIMATE2015 was greater than their POPESTIMATE 2014. This function should return a 5×2 DataFrame with the columns = (‘STNAME’, CTYNAME’) and the same index ID as the census_df (sorted ascending by index).
Expert Answer
Answer to Part 2 For the next set of questions, we will be using census data from the United States Census Bureau. Counties are po…
OR