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

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