Public
Edited
Jan 10
Insert cell
Insert cell
Insert cell
x = [0, ..._.shuffle([1, 2, 3])]
Insert cell
Insert cell
function reshape_energy(response) {
const zip = (row, columns) => _.zip(row, columns).map(d => d.flat());

const rows = response.data;
const columns = response.columns
const reshaped = rows.map(row => {
let zipped = zip(row, columns);
let obj = {}
zipped.forEach(d => {obj[d[1]] = d[0]});
return obj;
});

return reshaped;

}
Insert cell
Insert cell
reshaped_chars = reshape_characteristics(building)
Insert cell
reshaped_en = reshape_energy(building)
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
points = data.map(d => {
let scale = d3.scaleLinear([0, _.sum(d.weightedVals)], [0, 1]);
let ps = d.weightedVals.map(dd => scale(dd) * 100);
let zeros = new Array(ps.length).fill(0);
let zipped = _.zip(zeros, ps).flat();
zipped.push(0);
return {...d, points: zipped}
})
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