Public
Edited
Nov 5, 2024
Insert cell
Insert cell
viewof deps = multiAutoSelect({
options: liste_departements,
placeholder: "Choisir des départements à partir du numéro",
value: "31"
})
Insert cell
Plot.plot({
x: {label: null},
y: {percent: true},
marks: [
Plot.barY(
pyramide_ages,
{x: "AGED", y: d => d.individus/1000, fill: "departement", fy: "departement", tip: true}
),
Plot.ruleX([18], {stroke: "red"}),
Plot.tickY(
pyramide_ages,
{x: "AGED", y: d => d.individus/1000, fy: "departement"}
),
Plot.ruleY([0]),
Plot.axisY({label: "Population (en milliers)"}),
Plot.axisX({ticks: d3.ticks(0, 120, 10), label: "Âge", fontSize: 12})
]
})
Insert cell
Insert cell
query =
`
FROM read_parquet("${url_table_individus}")
SELECT
CAST(SUM(IPONDI) AS INT) AS individus,
CAST(AGED AS INT) AS AGED,
DEPT AS departement
WHERE DEPT IN ${selected_deps}
GROUP BY AGED, DEPT ORDER BY DEPT, AGED
`
Insert cell
liste_departements = liste_departements_duckdb.map(d=>d.dep)
Insert cell
liste_departements_duckdb = db.query(
`
FROM read_parquet("${url_table_individus}")
SELECT DISTINCT(DEPT) as dep
`
)
Insert cell
pyramide_ages = db.query(query)
Insert cell
db = DuckDBClient.of({})
Insert cell
import {multiAutoSelect} from "@linogaliana/multi-auto-select"
Insert cell
selected_deps = `(${deps.map(d=>`'${d}'`).join(", ")})`
Insert cell
url_table_individus = "https://static.data.gouv.fr/resources/recensement-de-la-population-fichiers-detail-individus-localises-au-canton-ou-ville-2020-1/20231023-122841/fd-indcvi-2020.parquet"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more