In [2]:
from bokeh.io import output_notebook, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
output_notebook()
x = list(range(-20, 21))
y0 = [abs(xx) for xx in x]
y1 = [xx**2 for xx in x]
# create a column data source for the plots to share
source = ColumnDataSource(data=dict(x=x, y0=y0, y1=y1))
TOOLS = "box_select,lasso_select,help"
# create a new plot and add a renderer
left = figure(tools=TOOLS, width=300, height=300, title=None)
left.circle('x', 'y0', source=source)
# create another new plot and add a renderer
right = figure(tools=TOOLS, width=300, height=300, title=None)
right.circle('x', 'y1', source=source)
p = gridplot([[left, right]])
show(p)
In [7]:
import pandas as pd
import numpy as np
buildings = pd.read_csv("data-readonly/Building_Inventory.csv")
In [14]:
buildings["Year Acquired"] = buildings["Year Acquired"].astype(pd.datetime)
buildings["Agency Name"] = buildings["Agency Name"].astype("category")
buildings["Year Acquired"].replace(0, np.nan, inplace=True)
buildings["Year Constructed"].replace(0, np.nan, inplace=True)
In [15]:
source = ColumnDataSource(data=buildings)
TOOLS = "box_select,lasso_select,help"
# create a new plot and add a renderer
left = figure(tools=TOOLS, width=300, height=300, title=None)
left.circle('Year Acquired', 'Square Footage', source=source)
# create another new plot and add a renderer
right = figure(tools=TOOLS, width=300, height=300, title=None)
right.circle('Year Constructed', 'Square Footage', source=source)
p = gridplot([[left, right]])
show(p)
In [ ]: