O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calculating covariance

Covariance indicates how two variables are related. A positive covariance means the variables are positively related, while a negative covariance means they are inversely related:

Covariance can be calculated using the .cov() method. The following code calculates the covariance between MSFT and AAPL:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required