@@ -21,7 +21,7 @@ def load_data():
2121 return df
2222
2323# Column order for displaying the details of a specific review
24- col_order = [' price' , ' points' , ' variety' , ' province' , ' description' ]
24+ col_order = [" price" , " points" , " variety" , " province" , " description" ]
2525
2626all_provinces = [
2727 "All" , "South Australia" , "Victoria" , "Western Australia" ,
@@ -33,7 +33,7 @@ def load_data():
3333province = Select (title = "Province" , options = all_provinces , value = "All" )
3434price_max = Slider (start = 0 , end = 900 , step = 5 , value = 200 , title = "Maximum Price" )
3535title = TextInput (title = "Title Contains" )
36- details = Div (text = ' Selection Details:' , width = 800 )
36+ details = Div (text = " Selection Details:" , width = 800 )
3737
3838# Populate the data with the dataframe
3939source = ColumnDataSource (data = load_data ())
@@ -59,13 +59,13 @@ def load_data():
5959 tools = TOOLS ,
6060 x_axis_label = "points" ,
6161 y_axis_label = "price (USD)" ,
62- toolbar_location = ' above' )
62+ toolbar_location = " above" )
6363
6464p .circle (
6565 y = "price" ,
66- x = ' points' ,
66+ x = " points" ,
6767 source = source ,
68- color = ' variety_color' ,
68+ color = " variety_color" ,
6969 size = 7 ,
7070 alpha = 0.4 )
7171
@@ -110,7 +110,7 @@ def selection_change(attrname, old, new):
110110 is used. Determine which items are selected and show the details below
111111 the graph
112112 """
113- selected = source .selected ['1d' ][ ' indices' ]
113+ selected = source .selected ["1d" ][ " indices" ]
114114
115115 # Need to get a list of the active reviews so the indices will match up
116116 df_active = select_reviews ()
@@ -119,7 +119,7 @@ def selection_change(attrname, old, new):
119119 # as an HTML table
120120 if selected :
121121 data = df_active .iloc [selected , :]
122- temp = data .set_index (' title' ).T .reindex (index = col_order )
122+ temp = data .set_index (" title" ).T .reindex (index = col_order )
123123 details .text = temp .style .render ()
124124 else :
125125 details .text = "Selection Details"
@@ -130,18 +130,18 @@ def selection_change(attrname, old, new):
130130controls = [province , price_max , title ]
131131
132132for control in controls :
133- control .on_change (' value' , lambda attr , old , new : update ())
133+ control .on_change (" value" , lambda attr , old , new : update ())
134134
135135# If the source is changed to a selection, execute that selection process
136- source .on_change (' selected' , selection_change )
136+ source .on_change (" selected" , selection_change )
137137
138138# The final portion is to layout the parts and get the server going
139139
140140# Build a box for all the controls
141- inputs = widgetbox (* controls , sizing_mode = ' fixed' )
141+ inputs = widgetbox (* controls , sizing_mode = " fixed" )
142142
143143# Define a simple layout
144- l = layout ([[desc ], [inputs , p ], [details ]], sizing_mode = ' fixed' )
144+ l = layout ([[desc ], [inputs , p ], [details ]], sizing_mode = " fixed" )
145145
146146# Update the data and instantiate the service
147147update ()
0 commit comments