import pandas as pd import numpy as np import plotly import getpass api_key=getpass.getpass() p = plotly.plotly('nipun.batra.1', api_key) df=pd.DataFrame({'A':np.random.rand(100), 'B':np.random.rand(100),'C':np.random.rand(100)} ,index= np.array(range(100))) df df.describe() df.plot() def df_to_iplot(df): ''' Coverting a Pandas Data Frame to Plotly interface ''' x = df.index.values lines={} for key in df: lines[key]={} lines[key]["x"]=x lines[key]["y"]=df[key].values lines[key]["name"]=key #Appending all lines lines_plotly=[lines[key] for key in df] return lines_plotly p.iplot(df_to_iplot(df)) date_rng = pd.date_range('2013-01-01 00:00','2013-01-03 10:00',freq='300s') df2=pd.DataFrame({'A':np.random.rand(len(date_rng)), 'B':np.random.rand(len(date_rng))}, index=date_rng) df2 df2.plot() p.iplot(df_to_iplot(df2)) def df_to_iplot(df): ''' Coverting a Pandas Data Frame to Plotly interface ''' if df.index.__class__.__name__=="DatetimeIndex": #Convert the index to MySQL Datetime like strings x=df.index.format() #Alternatively, directly use x, since DateTime index is np.datetime64 #see http://nbviewer.ipython.org/gist/cparmer/7721116 #x=df.index.values.astype('datetime64[s]') else: x = df.index.values lines={} for key in df: lines[key]={} lines[key]["x"]=x lines[key]["y"]=df[key].values lines[key]["name"]=key #Appending all lines lines_plotly=[lines[key] for key in df] return lines_plotly p.iplot(df_to_iplot(df2)) from IPython.display import HTML import requests styles = requests.get("https://raw.github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/master/styles/custom.css") HTML(styles.text)