Time-series data refers to a series of data points indexed over time. The data is recorded over regular time intervals and stored along with the time of collection. Some common examples of time series include stock prices, temperature, weather report, etc., as this information would make sense only when presented with the time they were recorded.
To understand time series, you will be working with a data set that contains the weather information of Austin City. Let's start exploring this further. You can use the Notebook provided below for this segment.
If a date-time variable has values in the form of a string, then you can call the ‘parse_dates
’ function while loading the data into the Pandas dataframe. This will convert the format into date-time for the appropriate variable. Also, when working with a time series, it is advisable to convert a column into the index for analysis. Let's see how this helps in further operations.
As you can see, once the data is loaded in the date-time format, Pandas can easily interpret the different representations of date and time. You can provide the date and/or time as the label for the row index and extract information for a particular time frame as needed. After that, you can perform all the operations covered in the previous segments over a time series.
Moving further, let us learn how to analyse a time series visually. If you recall from the last session on Matplotlib, a line plot is the best plot to analyse data over time as it reflects the trend over the desired time frame. Let's try to draw a line plot for temperature during the month of December in Austin City.
The line plot perfectly captures the variation between day and night temperatures in Austin City.