## 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 Value | Meaning |

1 | Perfect positive correlation: When one value increases, the other also increases, and vice versa. |

0 | No correlation: There is no visible relationship between the variables. |

-1 | Perfect negative correlation: When one value increases, the other decreases, and vice versa. |

**Correlation with Python:**

To calculate correlation, we will use the function `np.corrcoef()`

from **NumPy** with two parameters: the data sequences for which we want to find correlation. Take a look at the example:

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.

Everything was clear?

Course Content

Learning Statistics with Python

# Learning Statistics with Python

2. Mean, Median and Mode with Python

4. Covariance vs Correlation

## 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 Value | Meaning |

1 | Perfect positive correlation: When one value increases, the other also increases, and vice versa. |

0 | No correlation: There is no visible relationship between the variables. |

-1 | Perfect negative correlation: When one value increases, the other decreases, and vice versa. |

**Correlation with Python:**

To calculate correlation, we will use the function `np.corrcoef()`

from **NumPy** with two parameters: the data sequences for which we want to find correlation. Take a look at the example:

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.

Everything was clear?