In [1]:
import cufflinks as cf
import numpy as np
import pandas as pd
from plotly.offline import init_notebook_mode, plot, iplot
import plotly.graph_objs as go
In [2]:
init_notebook_mode(connected=False)
cf.go_offline()
In [3]:
df = pd.read_csv('../data/midwest.csv')
In [4]:
df.describe()
Out[4]:
In [5]:
sub = df[['poptotal', 'percollege']].dropna()[:10]
In [6]:
sub.iplot(filename='jupyter/percollege', sharing='private')
cufflinks helps a good bit by having that iplot method. Note that it is different from the plotly iplot function, as shown below:
In [7]:
N = 500
x = np.linspace(0, 1, N)
y = np.random.randn(N)
df2 = pd.DataFrame({'x': x, 'y': y})
df2.head()
Out[7]:
In [8]:
data2 = [go.Histogram(y=df2['y'])]
In [9]:
iplot(data2)
In [ ]: