Public
Edited
Jul 15, 2024
3 forks
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
columns = raw_data.columns;
Insert cell
viewof selectedColumns = Inputs.checkbox(columns, {label: "Select Columns", value: columns})

Insert cell
column_data = {
const selected = new Set(selectedColumns);
return raw_data.map(row => {
let newRow = {};
for (let key in row) {
if (selected.has(key)) {
newRow[key] = row[key];
}
}
return newRow;
});
}
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
summary_data = column_data.map(item => {
let newItem = { ...item };
Object.keys(newItem).forEach(key => {
if (key.includes('Year')) {
newItem[key] = new Date(newItem[key], 0, 1);
}
});
return newItem;
});
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

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