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

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