<jupyter_start><jupyter_text>`Time Series Analysis`<jupyter_code>import os
import pandas as pd
%matplotlib inline
from matplotlib import pyplot as plt
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
df = pd.read_excel('demo.xlsx')
df.head()
df.index = df.Date
plt.figure(figsize=(10, 6))
df['Close'].plot(color='b')
plt.title('Dow Jones Industrial Average between Jan 2016 - Dec 2016')
plt.xlabel('Time')
plt.ylabel('Closing Value')
plt.show()
lag = range(0,31)
djia_acf = []
for l in lag:
    djia_acf.append(df['Close'].autocorr(l))
plt.figure(figsize=(5.5, 5.5))
plt.plot(djia_acf, marker='.', color='b')
plt.title('Autocorrelation function for DJIA')
plt.xlabel('Lag in terms of number of trading days')
plt.ylabel('Autocorrelation function')
plt.show()
#Plot autocorrelation and confidence intervals using the plot_acf function
plt.figure(figsize=(5.5, 5.5))
plot_acf(df['Close'], lags=20);
#Plot partial autocorrelation and confidence intervals using the plot_acf function
plt.figure(figsize=(5.5, 5.5))
plot_pacf(df['Close'], lags=20);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14732965009208104, 'fraction_numerical': 0.027624309392265192, 'mean_word_length': 6.8768115942028984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '520669', 'license': 'MIT', 'n_tokens_mistral': 435, 'n_tokens_neox': 393, 'n_words': 97, 'path': 'DataScience365/Day-17/Time Series part-2.ipynb', 'repo_name': 'HiteshGorana/DataScience365', 'size': '1086'}