import numpy as np
import pandas as pd
from plotly import __version__
import cufflinks as cf
# import js libraries
from plotly.offline import download_plotlyjs,init_notebook_mode,plot,iplot
%matplotlib inline
# connect js to notebook
init_notebook_mode(connected=True)
cf.go_offline()
def prep_data():
"""
Read, Transpose, index and name columns
"""
df = pd.read_csv('/Users/4bic/projects/deliberate_practice/e-a_data/E-A_cellular_subscriptions.csv').T
df.rename(index=str, columns={0:'Kenya',1:'Sudan',
2:'Tanzania',3:'Uganda',
4:'Rwanda'},inplace=True)
df.drop(df.index[0],inplace=True)
return df
data = prep_data()
data.iplot()
data.iplot(kind='scatter',mode='markers',size=20)
data.iplot(kind='bar')
data.iplot(kind='box')
data.iplot(kind='surface',colorscale='rdylbu')
data.iplot(kind='hist',bins=30)
Turn column on / off by clicking on the legend
data.iplot(kind='hist',bins=30)
data.iplot(kind='spread')
df_ph = pd.read_csv('/Users/4bic/projects/deliberate_practice/e-a_data/E-A_cellulars_per_100.csv',index_col='Year')
df_ph.head()
df_ph.iplot()
df_ph.iplot(kind='spread')