In [2]:
#SKIP_COMPARE_OUTPUT
import pixiedust
In [3]:
from bokeh.sampledata.olympics2014 import data
from pandas.io.json import json_normalize
df = json_normalize(data['data'])
# try:
# from bkcharts.utils import df_from_json
# except ImportError:
# from bokeh.charts.utils import df_from_json
# # utilize utility to make it easy to get json/dict data converted to a dataframe
# df = df_from_json(data)
# filter by countries with at least one medal and sort by total medals
df = df[df['medals.total'] > 0]
df = df.sort_values("medals.total", ascending=False)
# show top 5
df.head(5)
Out[3]:
In [ ]:
#SKIP_COMPARE_OUTPUT
display(df, no_gen_tests='true')
In [15]:
display(df,cell_id='8a2e83d6eb8546df875cc18864d4c964',nostore_pixiedust='true',aggregation='SUM',binsize='10',chartsize='96',charttype='stacked',handlerId='tableView',keyFields='name',lineChartType='subplots',rendererId='bokeh',rowCount='100',showLegend='true',valueFields='medals.total',nostore_cw='1098',nostore_vh='1014',org_params='gen_tests,nostore_pixiedust',nostore_bokeh='true',prefix='318deeec',color='abbr')
In [6]:
display(df,cell_id='8a2e83d6eb8546df875cc18864d4c964',nostore_pixiedust='true',aggregation='SUM',binsize='10',chartsize='96',charttype='stacked',handlerId='histogram',keyFields='name',lineChartType='subplots',rendererId='bokeh',rowCount='100',showLegend='true',valueFields='medals.total',nostore_cw='1098',nostore_vh='1014',org_params='gen_tests,nostore_pixiedust',nostore_bokeh='true',prefix='2fe811d5')
In [9]:
display(df,cell_id='8a2e83d6eb8546df875cc18864d4c964',nostore_pixiedust='true',aggregation='SUM',binsize='10',chartsize='96',charttype='stacked',handlerId='scatterPlot',keyFields='medals.total',lineChartType='subplots',rendererId='bokeh',rowCount='100',showLegend='true',valueFields='medals.gold',nostore_vh='1014',org_params='gen_tests,nostore_pixiedust',nostore_bokeh='true',prefix='6103559e',color='abbr')
In [11]:
display(df,cell_id='8a2e83d6eb8546df875cc18864d4c964',nostore_pixiedust='true',aggregation='SUM',binsize='10',chartsize='96',charttype='stacked',handlerId='lineChart',keyFields='medals.silver',lineChartType='subplots',rendererId='bokeh',rowCount='100',showLegend='true',valueFields='medals.gold',nostore_vh='1014',org_params='gen_tests,nostore_pixiedust',nostore_bokeh='true',prefix='4f9da661',color='abbr')
In [13]:
display(df,cell_id='8a2e83d6eb8546df875cc18864d4c964',nostore_pixiedust='true',aggregation='SUM',binsize='10',chartsize='96',charttype='stacked',handlerId='barChart',keyFields='name',lineChartType='subplots',rendererId='bokeh',rowCount='100',showLegend='true',valueFields='medals.bronze,medals.silver,medals.gold',nostore_vh='1014',org_params='gen_tests,nostore_pixiedust',nostore_bokeh='true',prefix='8c0c4ba5',color='abbr')
In [ ]:
#TARGET=NO_RUN
#GoogleReader has stopped working properly, disabling for now
#SKIP_COMPARE_OUTPUT
import pixiedust
import pandas as pd
from pandas_datareader import data as web
import datetime
start = datetime.date(2015,1,1)
end = datetime.date.today()
ibm = web.DataReader('IBM','google',start,end)
apple = web.DataReader('AAPL', 'google', start, end)
microsoft = web.DataReader('MSFT','google',start,end)
stocks = pd.DataFrame({"IBM": ibm['Close'],\
"AAPL": apple['Close'],\
"MSFT": microsoft['Close']})
stocks.reset_index(inplace=True)
In [ ]:
#TARGET=NO_RUN
#SKIP_COMPARE_OUTPUT
display(stocks, no_gen_tests='true', dateFormat='%m/%d')
In [ ]:
#TARGET=NO_RUN
display(stocks, dateFormat='%m/%d',cell_id='C30E350068A445F9821AA5DCB2278A35',rendererId='bokeh',handlerId='lineChart',keyFields='Date',valueFields='AAPL,IBM,MSFT',aggregation='AVG',rowCount='100',charttype='subplots',nostore_cw='1099',nostore_pixiedust='true',org_params='gen_tests,dateFormat',nostore_bokeh='true',prefix='cbd6265b')
In [ ]:
#TARGET=NO_RUN
display(stocks, dateFormat='%m/%d',cell_id='C30E350068A445F9821AA5DCB2278A35',rendererId='bokeh',handlerId='lineChart',keyFields='Date',valueFields='AAPL,IBM,MSFT',aggregation='AVG',rowCount='100',charttype='subplots',nostore_cw='1099',nostore_pixiedust='true',org_params='gen_tests,dateFormat',nostore_bokeh='true',prefix='540af31c')
In [ ]:
#TARGET=NO_RUN
display(stocks, dateFormat='%m/%d',cell_id='C30E350068A445F9821AA5DCB2278A35',rendererId='bokeh',handlerId='barChart',keyFields='Date',valueFields='AAPL,IBM,MSFT',aggregation='AVG',rowCount='100',charttype='subplots',nostore_cw='1099',nostore_pixiedust='true',org_params='gen_tests,dateFormat',nostore_bokeh='true',prefix='13dfaad0')
In [ ]:
#TARGET=NO_RUN
display(stocks, dateFormat='%m/%d',cell_id='C30E350068A445F9821AA5DCB2278A35',rendererId='bokeh',handlerId='barChart',keyFields='Date',valueFields='AAPL,IBM,MSFT',aggregation='AVG',rowCount='100',nostore_cw='1099',nostore_pixiedust='true',org_params='gen_tests,dateFormat',nostore_bokeh='true',prefix='1e1e8556')