awacke1 commited on
Commit
c1d1902
·
verified ·
1 Parent(s): 1887ea3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -145,15 +145,16 @@ def main():
145
 
146
  if any(votes.values()):
147
  with col1:
148
- source = ColumnDataSource({
149
- 'names': [i["name"] for i in items if votes[i["url"]] > 0],
150
- 'votes': [i["votes"] for i in items if votes[i["url"]] > 0]
151
- })
152
- p = figure(x_range=source.data['names'],
 
153
  height=250,
154
  title="Vote Counts",
155
  toolbar_location=None)
156
- p.vbar(x='names', top='votes', width=0.9, source=source)
157
  p.xaxis.major_label_orientation = 1.2
158
  st.bokeh_chart(p)
159
 
 
145
 
146
  if any(votes.values()):
147
  with col1:
148
+ df = pd.DataFrame([
149
+ {'name': i["name"], 'votes': i["votes"]}
150
+ for i in items if votes[i["url"]] > 0
151
+ ])
152
+
153
+ p = figure(x_range=df['name'].tolist(),
154
  height=250,
155
  title="Vote Counts",
156
  toolbar_location=None)
157
+ p.vbar(x='name', top='votes', width=0.9, source=df)
158
  p.xaxis.major_label_orientation = 1.2
159
  st.bokeh_chart(p)
160