Jun-29-2018, 07:38 PM
(This post was last modified: Jun-29-2018, 07:39 PM by ichabod801.)
Trying to calculate the correlation coefficient between the two lists, so far no luck. Any suggestions or help would be greatly appreciated?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from table_utils import * from stats_utils import * cars = [ 29.9 , 30.2 , 30.3 , 30.1 , 30.3 , 30.4 , 30.5 , 30.9 , 31.1 , 31.5 , 31.7 ] papers = [ 337 , 322 , 311 , 299 , 264 , 242 , 213 , 191 , 190 , 174 , 164 ] car_list = [] papers_list = [] for car_row in cars: area = car_row[ 0 ] for papers_row in papers: if area = = papers_row[ 1 ]: car_list.append( float (car_row[ 1 ])) papers.append( float (papers_row[ 2 ])) corr = round (corr_coef(car_list, papers_list), 2 ) print ( 'Correlation coefficient =' , corr) |