Public
Edited
Nov 22, 2023
Insert cell
Insert cell
Insert cell
countryList = ["Norway"]; // Add or remove countries as needed
Insert cell
europe_energy_types_hydro@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
import {land} from "ff0a83b495637684"
Insert cell
import {countries as countries_to_merge} from "ff0a83b495637684"
Insert cell
function mergeData3(countries) {
// First, filter the counties that are present in the new_construction dataset
countries.features = countries.features.filter(feature => {
return europe_energy_types_hydro1.some(row => row.country === feature.properties.name);
});

// Next, map through the filtered counties and merge data
countries.features = countries.features.map(feature => {
const matchedState = europe_energy_types_hydro1.find(row => row.country == feature.properties.name);
if (matchedState) {
feature.properties.energy_2018 = matchedState.energy_2018;
feature.properties.energy_2018_char = matchedState.energy_2018_char;
feature.properties.type = matchedState.type;
feature.properties.energy_change = matchedState.energy_change;
feature.properties.energy_change_perc = matchedState.energy_change_perc;
feature.properties.energy_change_perc_char = matchedState.energy_change_perc_char;
}
return feature;
});

return countries
}
Insert cell
countries = mergeData3(countries_to_merge)
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