Trouble Graphing Data with Python
Question: I'm trying to create a program that will allow me to create a line graph of
random 10 year intervals of stocks. I'm able to get the data into a DataFrame
using pandas, but when I try to plot the information it won't pull up any
graph. There's no error so I'm stuck as to what could be going wrong. Any help
would be appreciated.

    
    
    import requests
    import numpy as np 
    from urllib2 import urlopen
    import csv
    import pandas as pd
    from pandas import *
    from pandas import DataFrame as df 
    
    import datetime
    import pandas.io.data
    from random import randint
    import matplotlib.pyplot as plt
    
    
    YahooUrl = 'http://ichart.yahoo.com/table.csv?s='
    start_month = 1 - 1
    start_day = 1
    start_year = 2010
    
    end_month = 12 - 1
    end_day = 31
    end_year = 2014
    
    Start_ApiMonth = '&a=%s' %(start_month)
    Start_ApiDay = '&b=%s' %(start_day)
    Start_ApiYear = '&c=%s' %(start_year)
    
    End_ApiMonth = '&d=%s' %(end_month)
    End_ApiDay = '&e=%s' %(end_day)
    End_ApiYear = '&f=%s' %(end_year)
    
    interval = 'm'
    
    ApiInterval = '&g=%s' %(interval)
    
    ApiStatic = '&ignore=.csv'
    
    Ticker = 'aapl'
    
    Website = urlopen(YahooUrl + Ticker + Start_ApiMonth + Start_ApiDay +     Start_ApiYear + End_ApiMonth + End_ApiDay + End_ApiYear + ApiInterval +  ApiStatic) 
    
    Info = pd.read_csv(Website)
    Table = df(Info)
    
    def Interval():
        end = randint(9,len(Table))
        start = end-10
        group = [start]
        while start <= end:
            group.append(start+1)
            start = start + 1
        return group
    
    interval = Interval()
    
    TableGraph = []
    TableGraph = Table['Adj Close'][interval]
    
    
    points = []
    for i in interval:
        points.append(Table['Adj Close'][i])
    
    TG = DataFrame(points, index=list('abcdefghijkl'), columns=list('x'))
    
    TG.plot()
    
    print Table 
    


Answer: You need to call show after plot:

    
    
    plt.show()
    

Which will give you something like:

[![enter image description
here](http://i.stack.imgur.com/p03QU.png)](http://i.stack.imgur.com/p03QU.png)

