From the course: Python Data Analysis
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Comparing quantitative variables - Python Tutorial
From the course: Python Data Analysis
Comparing quantitative variables
- [Instructor] Plotting two variables together helps us identify possible relations between them. Do they rise and fall together? Is it possible that changes in one may cause or be caused by changes in the other? We often pick one column in a dataset as the explanatory variable, and see if indeed it explains the variation in a response variable. Let's once again load the gapminder dataset. For data with timestamps, the simplest thing to do is to plot a variable using the date as the explanatory variable. That is, to plot a time series. I will focus on my country of birth, Italy, and show you a time series of population. So here's the restricted dataset, and here's a scatterplot of population against year. The rate of change of the population doesn't change very much across two centuries. The same plot will be different for China or India, especially after 1950. Here I am superimposing two plots by reusing the matplotlib axis returned by the first one. Going back to Italy, let's look…