Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
What we will learn
Know your problem
4. What is a time series?
Know your data
Visualize your data - bar chart
Work with your chart
Check yourself


Suppose we want to conduct our own study about air temperature in our neighborhood. First we'd have to get a thermometer and set it up outside. Then we could record the thermometer's temperature readings each day. If we wanted to be precise, we could also include the date each record was made.

After a few weeks, we would have a nice set of temperature data that we could use to assess the trends in our local weather. In this way, we will get a time series – a group of numerical values indexed by time. This is the kind of data we'll be dealing with in this section.

To sum up, a time series can be seen as a dataset with two columns. The dataset would have:

  • one numerical variable, with each value representing something at a specific moment in time (e.g. the air temperature),
  • one time variable, which tells us when the numerical value was recorded (e.g. the date).

For our local temperature, our dataset might look something like this:

       date        temperature
1   2015-03-01          15
2   2015-03-02          16
3   2015-03-03          17
4   2015-03-04          19
5   2015-03-05          14

We can see that the time variable acts like an index, ordering the numerical variable's values. For every numerical value (the temperature), there is only one index (the date).

What type of variable is a time variable? Is it categorical or numerical? As you'll see, its type depends on our interpretation of numerical variables. For now, let's look at the forms a time variable can take.