Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

In Matlab I use

a=[1,4,6] 

b=[1,2,3] 

corr(a,b)

which returns .9934. I've tried numpy.correlate but it returns something completely different. What is the simplest way to get the correlation of two vectors?

1 Answer

0 votes
by (106k points)

For getting a correlation of two vectors you can also use numpy.corrcoef:

import numpy 

print(numpy.corrcoef(a,b))

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...