image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import statsmodels.tsa.api as smt

MSFT = pd.read_csv('../input/Microsoft.csv', header=None)
AMZN = pd.read_csv('../input/Amazon.csv', header=None)
MSFT['AdjClose'] = pd.read_csv('../input/Microsoft.csv', header=None)
AMZN['AdjClose'] = pd.read_csv('../input/Amazon.csv', header=None)

def tsplot(y, lags=None, figsize=(15, 15), style='bmh'):
    if not isinstance(y, pd.Series):
        y = pd.Series(y)
    with plt.style.context(style):    
        fig = plt.figure(figsize=figsize)
        layout = (3, 2)
        ts_ax = plt.subplot2grid(layout, (0, 0), colspan=2)
        acf_ax = plt.subplot2grid(layout, (1, 0))
        pacf_ax = plt.subplot2grid(layout, (1, 1))
        
        y.plot(ax=ts_ax)
        ts_ax.set_title('Time Series Analysis Plots')
        smt.graphics.plot_acf(y, lags=lags, ax=acf_ax, alpha=0.7)
        smt.graphics.plot_pacf(y, lags=lags, ax=pacf_ax, alpha=0.7)
        plt.tight_layout()
    return 

np.random.seed(1)
whnoise = np.random.normal(size=1000)
tsplot(whnoise, lags=30)