Update app.py
Browse files
app.py
CHANGED
@@ -230,11 +230,6 @@ def moyenne_par_annee_par_quartier(data, quartier_id, year, scoring="score"):
|
|
230 |
|
231 |
# In[17]:
|
232 |
|
233 |
-
|
234 |
-
import plotly.io as pio
|
235 |
-
pio.renderers.default = 'browser'
|
236 |
-
|
237 |
-
|
238 |
# In[18]:
|
239 |
|
240 |
|
@@ -376,29 +371,18 @@ gdf_merged_q = pd.merge(new_gdf_q, new_df, how='left', left_on="adm2nm", right_o
|
|
376 |
|
377 |
geojson = gdf_merged_q.__geo_interface__
|
378 |
|
379 |
-
|
380 |
-
# In[109]:
|
381 |
-
|
382 |
-
|
383 |
-
geojson
|
384 |
-
|
385 |
-
|
386 |
# In[75]:
|
387 |
|
388 |
|
389 |
-
gdf_merged_q[gdf_merged_q['adm2nm'] == "Blitta"]
|
390 |
-
|
391 |
-
|
392 |
# # Map Scores de propreté pour les Préfectures du Togo
|
393 |
|
394 |
# Note: la carte est centrée. Il faut zoomer en arrière pour avoir le rendu.
|
395 |
|
396 |
# In[86]:
|
397 |
|
398 |
-
|
399 |
-
st.header('Score Propre')
|
400 |
|
401 |
-
|
402 |
geojson=geojson,
|
403 |
locations=gdf_merged_q.index,
|
404 |
color='scores',
|
@@ -407,8 +391,8 @@ with col1:
|
|
407 |
hover_name="adm2nm",
|
408 |
color_continuous_scale="Viridis"
|
409 |
)
|
410 |
-
|
411 |
-
|
412 |
# In[101]:
|
413 |
|
414 |
|
@@ -481,54 +465,10 @@ for q in quartiers:
|
|
481 |
qm[q] = moyenne_par_quartier(data, quartier_id[q], scoring="score responsabilité")
|
482 |
|
483 |
|
484 |
-
# In[94]:
|
485 |
-
|
486 |
-
|
487 |
-
ids = [quartier_id[q] for q in quartiers]
|
488 |
-
quartiers = list(qm.keys())
|
489 |
-
scores = list(qm.values())
|
490 |
-
|
491 |
-
|
492 |
-
# In[95]:
|
493 |
-
|
494 |
-
|
495 |
-
respon_df = pd.DataFrame(data={
|
496 |
-
'quartier': quartiers,
|
497 |
-
'scores': scores,
|
498 |
-
"quartier_id": ids
|
499 |
-
})
|
500 |
-
|
501 |
-
|
502 |
-
# In[102]:
|
503 |
-
|
504 |
-
|
505 |
-
gdf_merged_q_r = pd.merge(new_gdf_q, respon_df, left_on="adm2nm", right_on="quartier", how='left')
|
506 |
-
|
507 |
|
508 |
# In[ ]:
|
509 |
|
510 |
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
# In[100]:
|
515 |
-
|
516 |
-
with col2:
|
517 |
-
|
518 |
-
st.header('Scores Responsable')
|
519 |
-
fig = px.choropleth_mapbox(gdf_merged_q_r,
|
520 |
-
geojson=geojson,
|
521 |
-
locations=gdf_merged_q.index,
|
522 |
-
color='scores',
|
523 |
-
mapbox_style="carto-positron",
|
524 |
-
title="Scores de Propreté Pour Les Préfectures Du Togo",
|
525 |
-
hover_name="adm2nm",
|
526 |
-
color_continuous_scale="Viridis"
|
527 |
-
)
|
528 |
-
fig.update_layout(margin={'r':0, 't':0, "l": 0, 'r': 0})
|
529 |
-
st.plotly_chart(fig)
|
530 |
-
|
531 |
-
|
532 |
# In[ ]:
|
533 |
|
534 |
|
|
|
230 |
|
231 |
# In[17]:
|
232 |
|
|
|
|
|
|
|
|
|
|
|
233 |
# In[18]:
|
234 |
|
235 |
|
|
|
371 |
|
372 |
geojson = gdf_merged_q.__geo_interface__
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
# In[75]:
|
375 |
|
376 |
|
|
|
|
|
|
|
377 |
# # Map Scores de propreté pour les Préfectures du Togo
|
378 |
|
379 |
# Note: la carte est centrée. Il faut zoomer en arrière pour avoir le rendu.
|
380 |
|
381 |
# In[86]:
|
382 |
|
383 |
+
st.header('Score Propre')
|
|
|
384 |
|
385 |
+
fig = px.choropleth_mapbox(gdf_merged_q,
|
386 |
geojson=geojson,
|
387 |
locations=gdf_merged_q.index,
|
388 |
color='scores',
|
|
|
391 |
hover_name="adm2nm",
|
392 |
color_continuous_scale="Viridis"
|
393 |
)
|
394 |
+
fig.update_layout(margin={'r':0, 't':0, "l": 0, 'r': 0})
|
395 |
+
st.plotly_chart(fig)
|
396 |
# In[101]:
|
397 |
|
398 |
|
|
|
465 |
qm[q] = moyenne_par_quartier(data, quartier_id[q], scoring="score responsabilité")
|
466 |
|
467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
|
469 |
# In[ ]:
|
470 |
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
# In[ ]:
|
473 |
|
474 |
|