To normalize any set of numbers to be between 0 and 1, subtract the minimum and divide by the range. In your case the min is -1 and the range is 2, so if a value in your set is -0.5, that value becomes: (-0.5 - (-1)) / 2 =...

python,list,csv,python-3.x,pearson

Make the four columns(col2-col5) in this tsv file into separate lists, and I chose to ignore the line with Hawaii, since it has incomplete data, therefore using 49 data points. col0 = [] col1 = [] col2 = [] col3 = [] col4 = [] f = open('cdc_data.tsv', 'r')...

h := 0 for each c in C loop index := h xor c h := T[index] end loop return h OK, so this looks pretty imperative. When you see a loop like this, what you probably want to do is turn the "loop body" into a function, and then...

python,performance,numpy,matrix,pearson

The main problem with your implementation is the amount of memory you'll need to store the correlation coefficients (at least 4.5GB). There is no reason to keep the already computed coefficients in memory. For problems like this, I like to use hdf5 to store the intermediate results since they work...

If it's just the length of one of the vectors then use length. If you want the inferential calculations for the correlation coefficient equaling 0 then use cor.test (as the help page for ?cor tells you.) If it's the number of degrees of freedom for the test then look more...