import pandas_datareader.data as web import matplotlib.pyplot as plt from matplotlib import style import datetime as dt style.use('ggplot') # The goal here was to get practice getting data from a website and printing a graph with that data # Arbitrary date range, could easily be modified to accept user input start = dt.datetime(2006, 1, 1) end = dt.datetime(2016, 12, 31) # Ask User to specify which stock ticker to check stock_to_check = input("Enter a ticker symbol: ") # Request data from website (I have been using get.requests() for webscraping but this seems to be easier for my purposes df = web.DataReader(stock_to_check, 'yahoo', start, end) # Print off just the first and last 3 lines print(df.head(3)) print(df.tail(3)) plt.plot(df['Adj Close']) plt.ylabel('price') plt.show()