In [1]:
import MySQLdb as mdb
import pandas as pd
import plotly
plotly.offline.init_notebook_mode()

def getData():
    con = mdb.connect('127.0.0.1', 'root', 'paytm@197', 'stocks');
    data = pd.read_sql("select symbol,date,prev_close,open_price,high_price,low_price,last_price,\
                       close_price from stock_data where symbol in ('PNB','ICICIBANK') and series='EQ'\
                        and date>'2017-01-01'",con)
    return data
    
data= getData()
pivot = pd.pivot_table(data,values=["high_price","close_price"],index="date",columns="symbol")