Public
Edited
Nov 23, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Diamond_production.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
// Create a new table by combining the data from both tables
combinedTable = country_lat_long.map((countryData) => {
const matchingProductionData = diamond_production.find(
(productionData) => productionData.country === countryData.country
);

if (matchingProductionData) {
// Combine data from both tables into a new object
return {
country: countryData.country,
latitude: countryData.latitude,
longitude: countryData.longitude,
Diamond_production_mil_usd_2022: matchingProductionData.Diamond_production_mil_usd_2022,
};
} else {
// If there is no matching production data, create an entry with null production
return {
country: countryData.country,
latitude: countryData.latitude,
longitude: countryData.longitude,
Diamond_production_mil_usd_2022: null,
};
}
});

Insert cell
import {land} from "ff0a83b495637684"
Insert cell
import {country_lat_long} from "ff0a83b495637684"
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
import {Scrubber} from "@mbostock/scrubber"
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