In [1]:
import IPython.core.display as di

# This line will hide code by default when the notebook is exported as HTML
di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").length == 0) { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>', raw=True)

# This line will add a button to toggle visibility of code blocks, for use with the HTML export version
di.display_html('''<button onclick="jQuery('.input_area').toggle(); jQuery('.prompt').toggle();">Toggle code</button>''', raw=True)
In [2]:
import pandas as pd
analysis = pd.read_csv('withnewcalls.csv')
In [45]:
import plotly.plotly as py
py.sign_in('giannasally', 'rg1j7gqwzn')
In [3]:
import pandas as pd
names = ['INTPTLAT','INTPTLON','totalpp','onsitepp','offsitepp','totalper1000','onsiteper1000','offsiteper1000','ICE1','CONDISADV','CONDISAD_A','CONDISADVM','CONDISADVS','CONDISAD_B','CONDISADVL']

columns=['ObjectID','program','caseid','address','geopin','units','demolition_start','demolition_end','lat','lon']
blight= pd.read_csv('BlightStatus.CSV', sep=',', header=None, names=columns, encoding="utf-8")
In [4]:
from IPython.core.display import display, HTML
display(HTML('<h1>Blight And Alcohol Density</h1><p>Blue corresponds to each blight demolition and red to each alcohol point</p>'))

Blight And Alcohol Density

Blue corresponds to each blight demolition and red to each alcohol point

In [5]:
import pandas as pd
from bokeh.models.glyphs import Patches, Line, Circle
from bokeh.plotting import show, output_notebook,figure, output_file
from bokeh.models import (
    GMapPlot, GMapOptions, Range1d, DataRange1d, ColumnDataSource, LinearAxis,
    PanTool, WheelZoomTool,HoverTool, TapTool, OpenURL)
output_notebook()
x_range = DataRange1d()
y_range = DataRange1d()

map_options = GMapOptions(lat=30, lng=-90, zoom=10)

plot = GMapPlot(
    x_range=x_range, y_range=y_range,
    map_options=map_options,
    plot_width=800, plot_height=800
)
plot.map_options.map_type="terrain"
source = ColumnDataSource({'lat':analysis['INTPTLAT'],'lon':analysis['INTPTLON'],'total':analysis['totalper1000'],'ICE1':analysis['ICE1']})
circle = Circle(x="lon",y="lat",size=10,fill_color="red", fill_alpha=0.8, line_color=None)
source2 = ColumnDataSource({'lat':blight['lat'],'lon':blight['lon']})
circle2 = Circle(x="lon",y="lat",size=10,fill_color="blue", fill_alpha=0.3, line_color=None)
plot.add_glyph(source, circle)
plot.add_glyph(source2, circle2)
pan = PanTool()
wheel_zoom = WheelZoomTool()
hover = HoverTool()
hover.tooltips = [('ICE', '@ICE1')]
#tap = TapTool()
plot.add_tools(pan,wheel_zoom)
show(plot)