Hi Tester,
That dataset is a CSV file. I think you mean add columns for continent and geographical region, not rows. Here is one way to do that
Download and import the dataset
suicideImport = Import["~/Downloads/master.csv", "Dataset", HeaderLines -> 1];
One country's name does not match WL data so rename it
suicide =
suicideImport[All,
If[#country == "Saint Vincent and Grenadines", <|#, "country" -> "Saint Vincent and the Grenadines"|>, #] &];
Add continent column
suicide =
suicide[All, <|#, "continent" -> CanonicalName@CountryData[#country]["Continent"]|> &];
Country and region data is available here, download Excel and import
unsdImport =
Import["~/Downloads/UNSD \[LongDash] Methodology.xlsx", {"Dataset", 1}, HeaderLines -> 1];
Generate map from country name to region
regionMap =
unsdImport[
All, <|#"Country or Area" ->
If[#"Intermediate Region Name" == "", #"Sub-region Name", #"Intermediate Region Name"]|> &] //
Normal // Association;
Add region to suicide dataset
suicide = suicide[All, <|#, "region" -> regionMap[#country]|> &]
There are still some issues, country "Czech Republic" has no mapping to region.
Total number of suicides by continent and year
suicide[GroupBy[{#continent, #year} &] /* Values,
<|
"continent" -> Query[Max, #continent &],
"year" -> Query[Max, #year &],
"total_suicides" -> Query[Total, #"suicides_no" &]
|>]