Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Correlation | Covariance vs Correlation
Learning Statistics with Python
course content

Contenuti del Corso

Learning Statistics with Python

Learning Statistics with Python

1. Basic Concepts
2. Mean, Median and Mode with Python
3. Variance and Standard Deviation
4. Covariance vs Correlation
5. Confidence Interval
6. Statistical Testing

book
Correlation

Correlation is a statistical measure that quantifies the degree of association or relationship between two variables. In other words, it helps us understand how two variables tend to move in relation to each other.

Correlation provides a straightforward way to examine the result. The correlation value falls within the range of [-1, 1]. Refer to the table below:

Correlation with Python

To calculate correlation, use the np.corrcoef() function from numpy, which requires two parameters: the data sequences for which correlation is to be computed. Here's an example:

123456789
import pandas as pd import numpy as np df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/update/Stores.csv') # Calculating correlation corr = np.corrcoef(df['Store_Area'], df['Items_Available'])[0,1] print(corr)
copy

Here, we extracted the value at index [0, 1], just like in the case of covariance. In the previous chapter, we obtained the value 74955.85, and interpreting the result of the covariation function can be challenging. However, in this case, we can conclude that the values are strongly related.

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 2

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

course content

Contenuti del Corso

Learning Statistics with Python

Learning Statistics with Python

1. Basic Concepts
2. Mean, Median and Mode with Python
3. Variance and Standard Deviation
4. Covariance vs Correlation
5. Confidence Interval
6. Statistical Testing

book
Correlation

Correlation is a statistical measure that quantifies the degree of association or relationship between two variables. In other words, it helps us understand how two variables tend to move in relation to each other.

Correlation provides a straightforward way to examine the result. The correlation value falls within the range of [-1, 1]. Refer to the table below:

Correlation with Python

To calculate correlation, use the np.corrcoef() function from numpy, which requires two parameters: the data sequences for which correlation is to be computed. Here's an example:

123456789
import pandas as pd import numpy as np df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/update/Stores.csv') # Calculating correlation corr = np.corrcoef(df['Store_Area'], df['Items_Available'])[0,1] print(corr)
copy

Here, we extracted the value at index [0, 1], just like in the case of covariance. In the previous chapter, we obtained the value 74955.85, and interpreting the result of the covariation function can be challenging. However, in this case, we can conclude that the values are strongly related.

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 2
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt