Fixed import de lf dans stats

This commit is contained in:
Colin Maudry
2025-06-16 22:33:02 +02:00
parent 68b3072aa3
commit 88f37c199a
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ layout = [
children=[ children=[
html.H2(title), html.H2(title),
dcc.Markdown( dcc.Markdown(
"""Outil développé par Colin Maudry, sous licence GPL v3 (libre et gratuit). """Outil d'exploration des [Données Essentielles de la Commande Publique](), développé par Colin Maudry, sous licence GPL v3 (libre et gratuit).
- [wiki du projet](https://github.com/ColinMaudry/decp-processing/wiki) - [wiki du projet](https://github.com/ColinMaudry/decp-processing/wiki)
- [code source de decp.info](https://github.com/ColinMaudry/decp.info) - [code source de decp.info](https://github.com/ColinMaudry/decp.info)
+6 -4
View File
@@ -4,7 +4,7 @@ import plotly.express as px
import polars as pl import polars as pl
from dash import dcc, html, register_page from dash import dcc, html, register_page
from src.utils import df from src.utils import lf
title = "Statistiques" title = "Statistiques"
@@ -12,11 +12,11 @@ register_page(
__name__, path="/statistiques", title=f"decp.info - {title}", name=title, order=3 __name__, path="/statistiques", title=f"decp.info - {title}", name=title, order=3
) )
df = df.with_columns( lf = lf.with_columns(
pl.col("lieuExecution_code").str.head(2).str.zfill(2).alias("Département") pl.col("lieuExecution_code").str.head(2).str.zfill(2).alias("Département")
) )
df = ( lf = (
df.unique(subset="uid") lf.unique(subset="uid")
.select(["uid", "Département"]) .select(["uid", "Département"])
.unique(subset="uid") .unique(subset="uid")
.group_by("Département") .group_by("Département")
@@ -30,6 +30,8 @@ with open("./data/departements-1000m.geojson") as f:
for f in departements["features"]: for f in departements["features"]:
f["id"] = f["properties"]["code"] f["id"] = f["properties"]["code"]
df = lf.collect()
fig = px.choropleth( fig = px.choropleth(
df, df,
geojson=departements, geojson=departements,