Published
Edited
Jun 13, 2021
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
lists = {
let data = d3.rollup(raw, v => ({
candidates: v.length,
nuance: v[0]['Nuance Liste'],
candidatesNuances: [ ...new Set(v.map(c => c['Nuance candidat'])) ],
regions: [ ...new Set(v.map(c => c['Libellé de la région'])) ]
}),
d => d['Libellé Etendu Liste'])

return [...data.entries()].map(([name, data])=>({name, ...data}))
}
Insert cell
Insert cell
Insert cell
listsNuances = {
let data = d3.rollup(raw, v => ({
candidates: v.length,
lists: [ ...new Set(v.map(c => c['Libellé Etendu Liste'])) ],
listsShort: [ ...new Set(v.map(c => c['Libellé abrégé liste'])) ],
candidatesNuances: [ ...new Set(v.map(c => c['Nuance candidat'])) ],
regions: [ ...new Set(v.map(c => c['Libellé de la région'])) ]
}),
d => d['Nuance Liste'])

return [...data.entries()].map(([name, data])=>({name, ...data}))
}
Insert cell
Insert cell
Insert cell
candidatesNuances = {
let data = d3.rollup(raw, v => ({
candidates: v.length,
lists: [ ...new Set(v.map(c => c['Libellé Etendu Liste'])) ],
listsNuances: [ ...new Set(v.map(c => c['Nuance Liste'])) ],
regions: [ ...new Set(v.map(c => c['Libellé de la région'])) ]
}),
d => d['Nuance candidat'])

return [...data.entries()].map(([name, data])=>({name, ...data}))
}
Insert cell
Insert cell
Insert cell
regions = {
let data = d3.rollup(raw, v => ({
candidates: v.length,
lists: [ ...new Set(v.map(c => c['Libellé Etendu Liste'])) ],
listsShort: [ ...new Set(v.map(c => c['Libellé abrégé liste'])) ],
listsNuances: [ ...new Set(v.map(c => c['Nuance Liste'])) ],
candidatesNuances: [ ...new Set(v.map(c => c['Nuance candidat'])) ]
}),
d => d['Libellé de la région'])

return [...data.entries()].map(([name, data])=>({name, ...data}))
}
Insert cell
Insert cell
Insert cell
raw = d3.tsvParse(await FileAttachment("regionales-2021.csv").text())
Insert cell
d3 = require('d3')
Insert cell
import {datasetCard} from '@taniki/datagouvfr-oembed'
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more