{"id":12499,"date":"2020-02-20T12:22:42","date_gmt":"2020-02-20T06:52:42","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/"},"modified":"2024-09-03T15:01:37","modified_gmt":"2024-09-03T09:31:37","slug":"time-series-analysis-and-forecasting","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/","title":{"rendered":"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis"},"content":{"rendered":"\n<p>Time series analysis has been widely used for many <gwmw class=\"ginger-module-highlighter-mistake-type-3\" id=\"gwmw-15821831613861189821578\">purposes, but<\/gwmw> it is often neglected in machine learning. A time series can be any series of data that depicts the events that happened during a particular time period. This type of data often gives us a chance to predict future events by looking back into the past events. Nevertheless, it is also interesting to see that many industries use <a href=\"https:\/\/www.mygreatlearning.com\/blog\/time-series-forecasting\/\">time series forecasting<\/a> to solve various business problems. Before diving deep into the application of time series, we need to see the various parameters which should be considered in forecasting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"parameters\"><strong>Parameters<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"stationarity\"><span style=\"text-decoration: underline;\">Stationarity<\/span><gwmw style=\"display:none;\"><\/gwmw><\/h3>\n\n\n\n<p>Data attains stationarity when the properties such as average value, variation of the data, and standard deviation do not change over time. It is also an assumption to hold as the data which is not stationary can wrongly forecast results. Here\u2019s an example:<gwmw style=\"display:none;\"><\/p>\n\n\n\n<p>If we look closely into the above diagrams, the left diagram clearly tells that the data has an upward trend but it is not stationary. The graph clearly shows that the mean over the different time periods is not the same and is rapidly fluctuating. On the other hand, if we look into the right one, the data has no trend. It moves over a straight line and has a constant mean and variance over different time periods. Hence, this type of data is suitable for analysis.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"seasonality\"><span style=\"text-decoration: underline;\">Seasonality<\/span><gwmw style=\"display:none;\"><\/gwmw><\/h3>\n\n\n\n<p>Data is said to be seasonal when it changes exactly in the same way over a different time period. Let us consider the following data.<\/p>\n\n\n\n<p>If we look into the data, it contains the death toll of people from 2006 to 2016 i.e 10 years. Now we can see that the upward fluctuations occurred during the starting of every year and it came to a minimum during the mid-year period. This clearly implies that the death of these people follows a pattern and it can also be inferred that the death after the mid-year period is higher than the initial 6 months in every year. This is considered as another assumption of a time series data which needs to be true for successful forecasting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"autocorrelation\"><span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/autocorrelation\" target=\"_blank\" rel=\"noreferrer noopener\">Autocorrelation<\/a><\/span><gwmw style=\"display:none;\"><\/h3>\n\n\n\n<p>This is another important parameter which assumes that the data needs to be auto-correlated. Data is said to be auto-correlated when it shows similar observations over a time lag present in the data.<\/p>\n\n\n\n<p>Let\u2019s take a closer look at the chart above. If we see the data, we see that the first value and the 24<sup>th<\/sup> value happen to be the same. Also, the 12<sup>th<\/sup> value and the 36<sup>th<\/sup> value happen to be the same. A quick inference? The graph implies that the data follows a high correlation as it is showing similar observations in every 24-hour period. Although it is quite difficult to get data with these types of correlation, we can hold an assumption that the data should be approximately correlated.<\/p>\n\n\n\n<p>Take a look at this free resource for you to enhance your knowledge of time series: <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/time-series-analysis-stock-market-prediction-python\" target=\"_blank\" rel=\"noreferrer noopener\">Time Series Analysis Stock Market Prediction Python<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"applications\"><strong>Applications<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<p>Time series analysis can apply to many sectors including but not limited to:<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Power generation companies to observe the usage of electricity&nbsp;<\/li>\n\n\n\n<li>Financial sectors such as banking, stock market, etc.<\/li>\n\n\n\n<li>Weather forecasting to predict the weather.<\/li>\n\n\n\n<li>Traffic engineering to study traffic volume during peak hours.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/forecasting-hospital-blood-requirements\" target=\"_blank\" rel=\"noreferrer noopener\">Forecasting hospital blood requirements<\/a><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Time Series Analysis | Time Series Forecasting | Time Series Analysis in R | Ph.D. (Stanford)\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/FPM6it4v8MY?start=29&feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"types-of-time-series-analysis\"><strong>Types of time series analysis.<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<p>There are plenty of methods for time series analysis, some of them are:<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Moving Average method<\/li>\n\n\n\n<li>Exponential Smoothing<\/li>\n\n\n\n<li>Holt\u2019s Winter Method<\/li>\n\n\n\n<li>ARIMA<\/li>\n\n\n\n<li>RNN (Recurrent Neural Network)<\/li>\n<\/ol>\n\n\n\n<p>The first two types are often less used as they have limited capability when it comes to forecasting. RNN is a topic covered in deep learning. In this article, we will cover Holt\u2019s Winter Method and ARIMA as these two are the most commonly used when it comes to time series analysis. Interestingly, moving average and exponential smoothing techniques are quite na\u00efve and some of their traits are already present in ARIMA algorithm and Holt\u2019s Winter method so we will mainly focus on those.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-arima\"><strong>What is ARIMA?<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<p>ARIMA stands for Auto Regression Integrated Moving Average and is used to forecast time series following a seasonal pattern and a trend. It has three key aspects, namely:<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>AR - Auto Regression or simply AR denotes a relationship between an observation and a lagged observation.<\/li>\n\n\n\n<li>I - Integration or I stands for the steps required to make the data stationary. One na\u00efve step is to subtract an observation from one step previous observation thus making data stationary.<\/li>\n\n\n\n<li>MA- Moving Average or MA is an assumption that the model holds a relationship between an observation and the residuals of the moving average of the lagged observation.<\/li>\n<\/ol>\n\n\n\n<p>It uses a linear regression technique to make future forecasting by making the data stationary in order to remove trend and seasonality which can affect the overall performance of the model.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<p>Inclusive of its dynamic principle and its working process, it also considers three major parameters, failing which can lead to less intuitive forecasting.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>p- This parameter is also known as lag order which is defined as the number of lag observations present in the model.<\/li>\n\n\n\n<li>d- It is also known as the degree of differencing or simply defined as the steps that are required to make the data stationary.<\/li>\n\n\n\n<li>q- It is a window of moving average of the lagged observations and is also known as the order of moving average.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"applying-arima-in-python\"><span style=\"text-decoration: underline;\">Applying ARIMA in<a rel=\"noreferrer noopener\" aria-label=\" Python (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/python-tutorial-for-beginners-a-complete-guide\/\" target=\"_blank\"> Python<\/a><\/span><gwmw style=\"display:none;\"><\/gwmw><\/h3>\n\n\n\n<p>Let us code an ARIMA model in Python.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<p>We will be using some data on monthly milk production. Let us import all the necessary libraries:<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nimport numpy as np\nimport pandas as pd\nimport statsmodels.api as sm\nimport matplotlib.pyplot as plt\n<\/code><\/pre>\n\n\n\n<p>Now we will read the data and locate the head of it.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf = pd.read_csv(\u2018milk-production.csv')\ndf.head()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-2.png\"><img decoding=\"async\" width=\"466\" height=\"171\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-2.png\" alt=\"time series analysis\" class=\"wp-image-12505\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-2.png 466w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-2-300x110.png 300w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure>\n\n\n\n<p>The columns names are a bit fuzzy. Let us change it up.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf.columns = &#91;'Month','Milk in pounds per cow']\ndf.head()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-2-2.png\"><img decoding=\"async\" width=\"250\" height=\"165\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-2-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12506\"><\/figure>\n\n\n\n<p>Now it looks better.<\/p>\n\n\n\n<p>Next, let\u2019s perform a time series analysis. It is often required or considered mandatory to change the dates to proper data types and in python, we can do that by using 'pd.datetime'.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf&#91;'Month'] = pd.to_datetime(df&#91;'Month'])\ndf.head()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-3-2.png\"><img decoding=\"async\" width=\"270\" height=\"167\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-3-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12507\"><\/figure>\n\n\n\n<p>Now we will set the index to the date column.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf.set_index('Month',inplace=True)\ndf.head()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-4-2.png\"><img decoding=\"async\" width=\"256\" height=\"201\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-4-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12508\"><\/figure>\n\n\n\n<p>Now it is time to see the trend and seasonality of the data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf.plot()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-5-2.png\"><img decoding=\"async\" width=\"409\" height=\"289\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-5-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12510\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-5-2.png 409w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-5-2-300x212.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-5-2-100x70.png 100w\" sizes=\"(max-width: 409px) 100vw, 409px\" \/><\/figure>\n\n\n\n<p>As we see the data tends to be following a seasonal pattern having an upward trend.<\/p>\n\n\n\n<p>Now let us perform a rolling statistic to see the variation of the mean and standard deviation.<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ntimeseries = df &#91;'Milk in pounds per cow']\ntimeseries.rolling(12).mean().plot(label='12 Month Rolling Mean')\ntimeseries.rolling(12).std().plot(label='12 Month Rolling Std')\ntimeseries.plot()\nplt.legend()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-6-2.png\"><img decoding=\"async\" width=\"416\" height=\"300\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-6-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12511\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-6-2.png 416w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-6-2-300x216.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-6-2-324x235.png 324w\" sizes=\"(max-width: 416px) 100vw, 416px\" \/><\/figure>\n\n\n\n<p>As we see, the mean (average) of milk production is trending linearly upward.<br>Now we will be seeing the seasonality trend and residuals by using ETS decomposition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nfrom statsmodels.tsa.seasonal import seasonal_decompose\ndecomposition = seasonal_decompose(df&#91;'Milk in pounds per cow'], freq=12)  \nfigure = plt.figure()  \nfigure = decomposition.plot()  \nfigure.set_size_inches(15, 8)\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2.png\"><img decoding=\"async\" width=\"798\" height=\"415\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12512\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2.png 798w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2-300x156.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2-768x399.png 768w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-7-2-696x362.png 696w\" sizes=\"(max-width: 798px) 100vw, 798px\" \/><\/figure>\n\n\n\n<p>The data is indeed seasonal and follows an upward trend. Also, the average value or the mean of the residuals seem to be zero which holds our assumption.<\/p>\n\n\n\n<p>Now we will check whether the data is stationary or not. For this, we will perform a test called the Dickey-Fuller test. In the field of statistics, the Dickey-Fuller test (ADF) is used to test the null hypothesis, i.e. to check if a unit root is present in a sample of a time-series data. The alternative hypothesis is considered to be different on the version we use but is usually considered stationarity or trend-stationarity.<\/p>\n\n\n\n<p>Basically, we are trying to decide whether to accept the Null Hypothesis&nbsp;or go with the Alternative Hypothesis (that the time series has no unit root and is stationary).<\/p>\n\n\n\n<p>We end up deciding this based on the return of the p-value.<\/p>\n\n\n\n<p>A small p-value which is considered below 0.05 indicates strong evidence against the null hypothesis, thereby we reject the null hypothesis.<\/p>\n\n\n\n<p>A large p-value which is considered above 0.05 indicates weak or no evidence against the null hypothesis, thereby we fail to reject the null hypothesis.<gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n\n<p>Let's run the test:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nfrom statsmodels.tsa.stattools import adfuller\ntest_result = adfuller(df&#91;'Milk in pounds per cow'])\nprint ('ADF Test:')\nlabels = &#91;'ADF Statistic','p-value','No. of Lags Used','Number of Observations Used']\n\nfor value,label in zip(test_result,labels):\n    print (label+\u2019: '+str(value))\nif test result &#91;1] &lt;= 0.05:\n    print (\"Reject null hypothesis and data is stationary\")\nelse:\n    print (\"Fail to reject H0 thereby data is non-stationary \")\n<\/code><\/pre>\n\n\n\n<p>After running the above function, we get the following output.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n'ADF Test:'\n'ADF Statistic': -1.30381158742\np-value: 0.627426708603\nNo. of Lags Used: 13\nNumber of Observations Used: 154\n   Fail to reject H0 thereby data is non-stationary\n<\/code><\/pre>\n\n\n\n<p>Now we will build a function for further use to check the stationarity of the data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n# Store in a function for later use!\ndef check_adf(time_series):\n    test_result = adfuller(time_series)\n    print (ADF Test:')\n    labels = &#91;'ADF Statistic','p-value','No. of Lags Used','Number of Observations Used']\n    for value,label in zip(test_result,labels):\n        print (label+\u2019: '+str(value))\n    if test result &#91;1] &lt;= 0.05:\n        print (\"Reject null hypothesis and data is stationary\")\n    else:\n        print (\"fail to reject H0 and data is non-stationary \")\n\n<\/code><\/pre>\n\n\n\n<p>Now it is clear that the data is non-stationary so we need to apply differencing to make our data stationary.<\/p>\n\n\n\n<p>We have realised that our data is seasonal (it is also pretty obvious from the plot itself). This means we need to use Seasonal ARIMA on our model. If our data was not seasonal, it means we could have used just ARIMA on it. We will take this into account while differencing our data.<\/p>\n\n\n\n<p>Now let us do our first difference.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf &#91;'Milk First Difference'] = df &#91;'Milk in pounds per cow'] - df &#91;'Milk in pounds per cow']. shift (1)\nadf_check(df&#91;'Milk First Difference'].dropna())\n<\/code><\/pre>\n\n\n\n<p>After performing the above step, we get the following output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nADF Test:\nADF Statistic: -3.05499555865\np-value: 0.0300680040018\nNo. of Lags Used: 14\nNumber of Observations Used: 152\nReject null hypothesis and data is stationary\n<\/code><\/pre>\n\n\n\n<p>So, by doing the first difference we made our data stationary. Sometimes, we need to do more differencing in order to make our data stationary.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf &#91;'Milk First Difference']. plot ()\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-8-2.png\"><img decoding=\"async\" width=\"377\" height=\"270\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-8-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12513\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-8-2.png 377w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-8-2-300x215.png 300w\" sizes=\"(max-width: 377px) 100vw, 377px\" \/><\/figure>\n\n\n\n<p>Now we will check how autocorrelation works in the data by importing library to implement ACF plot.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nfrom statsmodels.graphics.tsaplots import plot_acf\nfig_first = plot_acf(df&#91;\"Milk First Difference\"].dropna())\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-9-2.png\"><img decoding=\"async\" width=\"376\" height=\"268\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-9-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12514\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-9-2.png 376w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-9-2-300x214.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-9-2-100x70.png 100w\" sizes=\"(max-width: 376px) 100vw, 376px\" \/><\/figure>\n\n\n\n<p>We can see that the data is showing similar fluctuations in the lagged observations which confirm that they are correlated.<\/p>\n\n\n\n<p>Now it's time to perform ARIMA.<\/p>\n\n\n\n<p>Please note we have seasonal data! So, we will use SARIMA<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nmodel = sm.tsa.statespace.SARIMAX(df&#91;'Milk in pounds per cow'],order=(0,1,0), seasonal_order=(1,1,1,12))\nARIMAresult = model.fit()\nprint (ARIMAresult.summary())\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-10-2.png\"><img decoding=\"async\" width=\"670\" height=\"422\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-10-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12515\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-10-2.png 670w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-10-2-300x189.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-10-2-667x420.png 667w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><\/figure>\n\n\n\n<p>Here the main thing to observe is the AIC which should be minimum. To improve our model, we can play around changing the p,d,q parameters and the model which gives the least AIC is the best model.<\/p>\n\n\n\n<p>Now let us predict the future values to see how it performs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf&#91;'forecast_data'] = ARIMAresult.predict(start = 150, end= 168, dynamic= True)  \ndf &#91;&#91;'Milk in pounds per cow','forecast_data']]. plot (figsize= (12,8))\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2.png\"><img decoding=\"async\" width=\"708\" height=\"460\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12516\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2.png 708w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2-300x195.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2-696x452.png 696w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-11-2-646x420.png 646w\" sizes=\"(max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p>As we can see, the model is performing just the way we expected.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"applying-arima-in-r\"><span style=\"text-decoration: underline;\">Applying ARIMA in R<\/span><\/h3>\n\n\n\n<p>We have seen how time series using ARIMA works in Python. Now we can see how it works in R.<\/p>\n\n\n\n<p>For R, we will be using a restaurant dataset which contains data of visitors in a restaurant during a particular time period.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf_air &lt;- read_csv (file = '..\/input\/recruit-restaurant-visitor-forecasting\/air_visit_data.csv')\ndf_air_store &lt;- read_csv('..\/input\/recruit-restaurant-visitor-forecasting\/air_store_info.csv')\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2.png\"><img decoding=\"async\" width=\"715\" height=\"351\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12517\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2.png 715w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2-300x147.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2-696x342.png 696w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2-324x160.png 324w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-12-2-533x261.png 533w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/figure>\n\n\n\n<p>From the above diagram, we can infer that there is a strong increase in the number of visitors from mid-2016 and it is hard to verify the cause of such an increase. So, we will take the data from July 2016.<\/p>\n\n\n<figure class=\"wp-block-image size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2.png\"><img decoding=\"async\" width=\"706\" height=\"350\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12519\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2.png 706w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2-300x149.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2-696x345.png 696w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-13-2-324x160.png 324w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p>Now we will fit an ARIMA model to predict visitors who visited the restaurant from February 2017 and see how it performs. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nmerged_train &lt;- merged_sum %&gt;% filter (visit_date &lt;='2017-02-01')\nmerged_test &lt;- merged_sum %&gt;% filter (visit_date &gt;'2017-02-01')\n\n#print(paste(nrow(merged_sum), nrow(merged_train), nrow(merged_test)))\nm &lt;- arima(merged_train$visitors, order=c(2,1,2), seasonal= list(order=c(1,1,1), period=7))\ny_prediction &lt;- forecast: forecast (m, h=80)\npar (mfrow=c (1,1), cex=0.7)\nplot(ts(merged_sum$visitors), main=\"ARIMA model predictions, cut off at Feb 2017\")\nlines (y_prediction$mean, col='red')\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-14-2.png\"><img decoding=\"async\" width=\"538\" height=\"527\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-14-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12521\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-14-2.png 538w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-14-2-300x294.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-14-2-429x420.png 429w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/figure>\n\n\n\n<p>Now after fitting, we have come to see that the model just performs how we expected. However, we can play around with the parameters such as order and period to see any further improvements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"holts-winter-method-an-overview\"><strong>Holt\u2019s Winter Method - An Overview<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<p>Holt\u2019s Winter method is a type of exponential smoothing technique which is used to forecast for a shorter time period by either using additive or multiplicative approach over a particular trend and seasonality. The parameters used for smoothing in this method are alpha, beta and gamma which have following functions<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The alpha parameter is used as a smoothing factor for the level.<\/li>\n\n\n\n<li>The beta parameter is used to perform exponential smoothing to the data having trend. To perform the same, we must set it to FALSE.<\/li>\n\n\n\n<li>The gamma parameter is used for components having seasonality. If we set it to FALSE, the model fitted will be non-seasonal.<\/li>\n<\/ul>\n\n\n\n<p>Holt\u2019s winter method is determined based on the nature of the data and its seasonal pattern. If the seasonality tends to be linear, we use the additive seasonality approach. If the seasonality tends to be exponential, we use the multiplicative seasonality approach.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"applying-holts-winter-method-in-r\"><span style=\"text-decoration: underline;\">Applying Holt\u2019s Winter method&nbsp; in R<\/span><gwmw style=\"display:none;\"><\/gwmw><\/h3>\n\n\n\n<p>We will be implementing Holt\u2019s Winter method in R. The data we will use is monthly sales data which consists of sales figures for a particular day and we need to forecast for the next 12 months.<\/p>\n\n\n\n<p>Let us import the following libraries:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nlibrary(readr)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(forecast)\n<\/code><\/pre>\n\n\n\n<p>Let us read and check the head of the data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ndf &lt;- read_csv(\"..\/input\/MonthlySales.csv\")\nNow let us check the first five rows\nhead (df, n = 5)\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-15-2.png\"><img decoding=\"async\" width=\"175\" height=\"120\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-15-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12523\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-15-2.png 175w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-15-2-100x70.png 100w\" sizes=\"(max-width: 175px) 100vw, 175px\" \/><\/figure>\n\n\n\n<p>Now let us plot the data to see the trend and seasonality.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\noptions (repr.plot.width = 6, repr.plot.height = 3)\nggplot(df, aes(x = month, y = sales)) + geom_line() + geom_smooth(method = 'lm') +labs(x = \"Time\", y = \"Monthly Sales\")\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-16-2.png\"><img decoding=\"async\" width=\"720\" height=\"359\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-16-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12524\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-16-2.png 720w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-16-2-300x150.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-16-2-696x347.png 696w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/figure>\n\n\n\n<p>Looking closely, the data is trending upward and it has seasonality which is extending in a linear fashion. So, we will use the additive model for this data.<br>Now we will observe trend and seasonality individually by using decomposition plot. For that, we need to convert the sales column to a time series object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nNew_sale&lt;- ts(df$sales, frequency = 12, start = c(2013,1))\nclass (New_sale)\n<\/code><\/pre>\n\n\n\n<p>Let us see the decomposition plot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\noptions (repr.plot.width = 6, repr.plot.height = 5)\nsalesDecomp_plot &lt;- decompose (New_sale)\nplot(salesDecomp_plot)\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2.png\"><img decoding=\"async\" width=\"725\" height=\"553\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12525\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2.png 725w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2-300x229.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2-696x531.png 696w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2-551x420.png 551w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-17-2-80x60.png 80w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/figure>\n\n\n\n<p>The data follows an upward trend and it also has a seasonal pattern. Now it's time to build the model.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nSales_Log &lt;- log (New_sale)\nHW_model &lt;- HoltWinters(Sales_Log)\nHW_model\n<\/code><\/pre>\n\n\n\n<p>After fitting the model, let us visualise to see how did it perform.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\noptions (repr.plot.width = 6, repr.plot.height = 4)\nplot (HW_model)\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2.png\"><img decoding=\"async\" width=\"713\" height=\"451\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12526\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2.png 713w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2-300x190.png 300w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2-696x440.png 696w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-18-2-664x420.png 664w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><\/figure>\n\n\n\n<p>Well, the model performed exceptionally well as the observed values and the fitted values match closely. So hopefully, it won\u2019t fail in prediction. Let us do that. We will predict for the next 12 months.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nForecast_sales &lt;- forecast (HW_model, h=12)\n# plot\nplot (Forecast_sales)\n<\/code><\/pre>\n\n\n<figure class=\"wp-block-image aligncenter size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-19-2.png\"><img decoding=\"async\" width=\"643\" height=\"359\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-19-2.png\" alt=\"Time Series Analysis\" class=\"wp-image-12527\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-19-2.png 643w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-19-2-300x167.png 300w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inference\"><strong>Inference<\/strong><gwmw style=\"display:none;\"><\/gwmw><\/h2>\n\n\n\n<p>ARIMA can deal with any time series analysis as it makes the data stationary first, but it is not the case in Holt\u2019s Winter method.&nbsp; Holt\u2019s Winter method considers that the data must have a trend and seasonality. Nevertheless, the error in prediction is more compared to ARIMA. Mostly the real-world data such as stock market data which are quite difficult to analyse often use deep learning techniques such as RNN, LSTM, etc.<br><\/p>\n\n\n\n<p><em>If you wish to learn more about time series analysis and other concepts of data science and analytics, upskill with <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-data-science-and-business-analytics-course\" target=\"_blank\" rel=\"noreferrer noopener\">Great Learning's PG program in Data Science<\/a>. <\/em><\/p>\n\n\n\n<p>Explore endless possibilities with our comprehensive selection of <a href=\"https:\/\/www.mygreatlearning.com\/academy\" target=\"_blank\" rel=\"noreferrer noopener\">free courses<\/a>. Whether you're interested in Cybersecurity, Management, Cloud Computing, IT, or Software, Artificial Intelligence and Machine Learning, we have the perfect industry-relevant domain for you. Gain the essential skills and expertise needed to excel in your desired field.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time series analysis has been widely used for many purposes, but it is often neglected in machine learning. A time series can be any series of data that depicts the events that happened during a particular time period. This type of data often gives us a chance to predict future events by looking back into [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":12528,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[9],"tags":[],"content_type":[],"class_list":["post-12499","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-science"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis<\/title>\n<meta name=\"description\" content=\"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis\" \/>\n<meta property=\"og:description\" content=\"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-20T06:52:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-03T09:31:37+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"850\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis\",\"datePublished\":\"2020-02-20T06:52:42+00:00\",\"dateModified\":\"2024-09-03T09:31:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/\"},\"wordCount\":2217,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/time-series-analysis-1.jpg\",\"articleSection\":[\"Data Science and Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/\",\"name\":\"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/time-series-analysis-1.jpg\",\"datePublished\":\"2020-02-20T06:52:42+00:00\",\"dateModified\":\"2024-09-03T09:31:37+00:00\",\"description\":\"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/time-series-analysis-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/time-series-analysis-1.jpg\",\"width\":1200,\"height\":850,\"caption\":\"Time Series Analysis\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/time-series-analysis-and-forecasting\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Science and Analytics\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/data-science\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Learn to Forecast a Time Series in Python &#8211; All You Want to Know About Time Series Analysis\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis","description":"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/","og_locale":"en_US","og_type":"article","og_title":"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis","og_description":"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2020-02-20T06:52:42+00:00","article_modified_time":"2024-09-03T09:31:37+00:00","og_image":[{"width":1200,"height":850,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis","datePublished":"2020-02-20T06:52:42+00:00","dateModified":"2024-09-03T09:31:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/"},"wordCount":2217,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg","articleSection":["Data Science and Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/","url":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/","name":"Learn to Forecast a Time Series in Python - All You Want to Know About Time Series Analysis","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg","datePublished":"2020-02-20T06:52:42+00:00","dateModified":"2024-09-03T09:31:37+00:00","description":"Time Series Analysis and Forecasting: Read About Time series analysis and forecasting along with implementation on Python and R using different techniques.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg","width":1200,"height":850,"caption":"Time Series Analysis"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/time-series-analysis-and-forecasting\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Data Science and Analytics","item":"https:\/\/www.mygreatlearning.com\/blog\/data-science\/"},{"@type":"ListItem","position":3,"name":"Learn to Forecast a Time Series in Python &#8211; All You Want to Know About Time Series Analysis"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",1200,850,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-300x213.jpg",300,213,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-768x544.jpg",768,544,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1-1024x725.jpg",1024,725,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",1200,850,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",1200,850,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",640,453,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",96,68,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/time-series-analysis-1.jpg",150,106,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":1,"uagb_excerpt":"Time series analysis has been widely used for many purposes, but it is often neglected in machine learning. A time series can be any series of data that depicts the events that happened during a particular time period. This type of data often gives us a chance to predict future events by looking back into&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=12499"}],"version-history":[{"count":25,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12499\/revisions"}],"predecessor-version":[{"id":109087,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12499\/revisions\/109087"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/12528"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=12499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=12499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=12499"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=12499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}