Skip to content
Advertisement

how to calculate correlation coefficient for a scatter-plot in scipy

i am trying to calculate the correlation coefficient for a scatterplot with scipy, the thing is, i have a kind of complex dataset in an ndarray, and the basic syntax does not work for me…

here is my full code:

JavaScript

Advertisement

Answer

pearsonr works fine on your data

JavaScript

You were passing two floats (namely values at the row i) as the error says, however corr takes two arrays, in your case the two columns.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement