import pandas as pd from bokeh.plotting import figure, output_file, show,output_notebook output_notebook()
def make_dashboard(x, gdp_change, unemployment, title, file_name): output_file(file_name) p = figure(title=title, x_axis_label='year', y_axis_label='%') p.line(x.squeeze(), gdp_change.squeeze(), color="firebrick", line_width=4, legend="% GDP change") p.line(x.squeeze(), unemployment.squeeze(), line_width=4, legend="% unemployed") show(p)
links={'GDP':'https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/projects/coursera_project/clean_gdp.csv',\ 'unemployment':'https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/projects/coursera_project/clean_unemployment.csv'}
csv_path = links['GDP'] df = pd.read_csv(csv_path) df.head()
csv_path = links['unemployment'] df = pd.read_csv(csv_path) df.head()
df[df['unemployment'] > 8.5]
csv_path=links['GDP'] gdp_dataframe=pd.read_csv(csv_path) x = pd.DataFrame(gdp_dataframe, columns=['date']) x.head()
gdp_change = pd.DataFrame(gdp_dataframe, columns=['change-current']) gdp_change.head()
unemploy_dataframe= pd.read_csv(csv_path) unemployment = pd.DataFrame(unemploy_dataframe, columns=['unemployment']) unemployment.head()
title = "Unemployement stats according to GDP"
file_name = "index.html"
make_dashboard(x=x, gdp_change=gdp_change, unemployment=unemployment, title=title, file_name=file_name)