#!/usr/bin/env python # coding: utf-8 # In[ ]: title = "Stock Time Series" # In[ ]: import datetime import numpy as np import pandas as pd import pandas_datareader.data as web import plotly.graph_objects as go # In[ ]: start = datetime.datetime(2015, 1, 1) end = datetime.datetime(2019, 12, 1) # In[ ]: df_1 = web.DataReader("AAPL", "yahoo", start, end).reset_index() df_2 = web.DataReader("MSFT", "yahoo", start, end).reset_index() df_3 = web.DataReader("AMZN", "yahoo", start, end).reset_index() # ### Apple # In[ ]: margin = go.layout.Margin(l=20, r=20, b=20, t=30) # In[ ]: fig = go.Figure([go.Scatter(x=df_1['Date'], y=df_1['Close'])]) fig.update_layout(margin=margin) fig # ### Microsoft # In[ ]: fig = go.Figure([go.Scatter(x=df_2['Date'], y=df_2['Close'])]) fig.update_layout(margin=margin) fig # ### Amazon # In[ ]: fig = go.Figure([go.Scatter(x=df_3['Date'], y=df_3['Close'])]) fig.update_layout(margin=margin) fig # In[ ]: