Public
Edited
Dec 13, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data_postproc
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data_postproc = data_raw.map(row => {
let object = row
object['Aktiv Autofahren?'] = ((row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [PKW]']=="fast immer") || (row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [PKW]']=="häufig"))
object['Mind. ein Auto im Haushalt'] = (row['Wie viele Autos haben Sie in Ihrem Haushalt?']>0)

object['Aktiv Fahrradfahren?'] = ((row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [Fahrrad]']=="fast immer") || (row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [Fahrrad]']=="häufig"))

object['Aktiv ÖPNV?'] = ((row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [ÖPNV]']=="fast immer") || (row['Welche Mobilitätsformen nutzen Sie mit welcher Häufigkeit? [ÖPNV]']=="häufig"))

if ((object['Aktiv Autofahren?']) && (!(object['Aktiv Fahrradfahren?']))) {
object['Porträt'] = "Autofahrer(in)"
} else if ((object['Aktiv Fahrradfahren?']) && (!(object['Aktiv Autofahren?']))) {
object['Porträt'] = "Radfahrer(in)"
} else if ((object['Aktiv Fahrradfahren?']) && (object['Aktiv Autofahren?'])) {
object['Porträt'] = "Hybrid Auto/Fahrrad"
} else if ((!object['Aktiv Fahrradfahren?']) && (!object['Aktiv Autofahren?']) && (object['Aktiv ÖPNV?'])) {
object['Porträt'] = "ÖPNV-Nutzer(in)"
} else {
object['Porträt'] = "Sonstiges"
}
return object
})
Insert cell
results-survey315277-4.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
function addColumn(tableData, newColumnName, newColumnFunction) {
return tableData.map(row => {
let returnObject = row;
returnObject[newColumnName] = newColumnFunction(row)
return returnObject
})
}
Insert cell
import {surveyPieChart as pie} from "@observablehq/survey-pie-chart"
Insert cell
import {surveyHistogram as histogram} from "@observablehq/survey-histogram"
Insert cell
import {survey} from "@observablehq/survey-library"
Insert cell
import {FreeResponse} from "@observablehq/survey-free-response-component"
Insert cell
d3 = require("d3@6")
Insert cell
colorsGruene = ["#fff17a", "#0ba1dd", "#8abd24", "#008939", "#005437"]
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