Published
Edited
Jun 20, 2021
1 fork
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(instituts)
Insert cell
instituts = [... new Set(sondages.map(s => s.nom_institut))]
.map(i => ({
institut: i,
sondages: sondages.filter(s => s['nom_institut'] == i),
regions: [...new Set(sondages.filter(s => s['nom_institut'] == i).map(s => s.region))]
}))
.sort((a,b) => b.sondages.length - a.sondages.length)
Insert cell
Insert cell
Insert cell
Inputs.table(commanditaires)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
regionsMinint.map(r => r.name)
Insert cell
[...new Set(sondages.map(s => s['region']))]
Insert cell
regionsNom = regionsMinint.map(r => r.name)
Insert cell
regions = regionsNom //[...new Set(sondages.map(s => s['region']))]
.map(r => ({
region: r,
sondages: sondages.filter(s => s['region'] == r)
}))
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(tetes)
Insert cell
tetes = sondages.map(s => s.tours.map(t => t.hypotheses.map(h => h.tetes_liste.map(tl => ({region: s.region, tour: t.tour, ...tl}))))).flat(11)
Insert cell
Insert cell
Insert cell
tours = [... new Set(sondages.map(s => s.tours.map(t => t.tour)).flat(3))]
.map(t => ({
tour: t,
hypotheses: hypotheses.filter(h => h.tour == t)
}))
Insert cell
Insert cell
Insert cell
Insert cell
nsp = hypotheses.map(h => ({
sondage: h.sondage,
'somme == 100': d3.sum(h.tetes_liste.map(c => c.intentions)) == 100,
'nsp': h.tetes_liste.find(c => c.tete_liste == undefined)
}))
Insert cell
Insert cell
Insert cell
[... new Set(nsp.filter(s => !s['somme == 100']).map(s => s.sondage))].length
Insert cell
Insert cell
[...new Set(nsp.filter(s => s['nsp']).map(s=>s.sondage))]
.map(s => sondages.find(s2 => s2.id == s))
Insert cell
Insert cell
[...new Set(nsp.filter(s => s['nsp']).map(s=>s.sondage))].length
Insert cell
sondages.length
Insert cell
Insert cell
Insert cell
Insert cell
import { sondages } from '@taniki/regionales2021-sondages'
Insert cell
import { regions as regionsMinint } from '@taniki/regionales2021-donnees-minint'
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