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

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