Feb-02-2019, 10:19 PM
Alright, so I have a bunch of data from elections, one of the questions was to break the data down by state and look at the racial demographics (percentage of each race that makes up the state population) and compare that to the Republican Relative Vote for 2016 election. I have all of the data in a dataframe where the State acts as the index, it looks like this:
These are the column headings
White (Not Latino) Population : (percentage) for all races
African American Population
Native American Population
Asian American Population
Latino Population
White Asian
Other Race or Races
Republican Relative Vote 08 (decimal percentage)
Republican Relative Vote 12
Republican Relative Vote 16
ST : abbreviation for state
how do I create a correlation matrix from this?
I tried df.corr(), but it just gave me a matrix excluding all of the racial data. I need correlations between each race and the relative vote count, grouped by state.
These are the column headings
White (Not Latino) Population : (percentage) for all races
African American Population
Native American Population
Asian American Population
Latino Population
White Asian
Other Race or Races
Republican Relative Vote 08 (decimal percentage)
Republican Relative Vote 12
Republican Relative Vote 16
ST : abbreviation for state
how do I create a correlation matrix from this?
I tried df.corr(), but it just gave me a matrix excluding all of the racial data. I need correlations between each race and the relative vote count, grouped by state.