Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correlation Matrix Problem
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I am getting a valueError. And not sure why? My goal is to visualize the correlation ReadytoCode 0 416 Dec-11-2023, 05:33 AM
Last Post: ReadytoCode
  Check if two matrix are equal and of not add the matrix to the list quest 3 778 Jul-10-2023, 02:41 AM
Last Post: deanhystad
  Error in find pearson correlation function erneelgupta 1 1,810 Mar-01-2022, 03:41 PM
Last Post: stevendaprano
  How to increase the size of a png picture for the heatmap of the correlation? lulu43366 9 3,386 Oct-06-2021, 04:15 PM
Last Post: deanhystad
  How to remove a column or two columns in a correlation heatmap? lulu43366 3 5,081 Sep-30-2021, 03:47 PM
Last Post: lulu43366
  How to multiply a matrix with herself, until the zero matrix results peanutbutterandjelly 3 3,303 May-03-2021, 06:30 AM
Last Post: Gribouillis
  Problem in matrix leemao 1 2,117 Jun-27-2020, 12:48 PM
Last Post: Yoriz
  Correlation thomaschu 0 1,522 Jan-29-2020, 05:45 PM
Last Post: thomaschu
  Computing correlation in audio files ryanblumenow 0 2,725 Jan-15-2020, 06:11 PM
Last Post: ryanblumenow
  Matrix Calculation Problem arshad 4 2,590 Nov-04-2019, 03:48 PM
Last Post: baquerik

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020