0
$\begingroup$

I was planning to create an array with all capital cities in Europe using the following command:

CountryData["Europe", "CapitalCity"]

But unfortunately, it returns all results in rectangular frames. How can I get rid of them and get a simple text?

$\endgroup$

2 Answers 2

1
$\begingroup$

You can use the functions CanonicalName and CommonName:

eucc = CountryData["Europe", "CapitalCity"]

enter image description here

CanonicalName @ eucc

enter image description here

CommonName @ eucc

enter image description here

You can also use EntityValue "Name" to get CommonName[eucc]:

EntityValue[eucc, "Name"] == CommonName[eucc]
True
$\endgroup$
1
$\begingroup$

Use EntityValue with the property "CanonicalName":

EntityValue[CountryData["Europe","CapitalCity"],"CanonicalName"]

{{"Tirana", "Tirana", "Albania"}, {"AndorraLaVella", "AndorraLaVella", "Andorra"}, {"Vienna", "Vienna", "Austria"}, {"Minsk", "Minsk", "Belarus"}, {"Brussels", "Brussels", "Belgium"}, {"Sarajevo", "FederacijaBosnaIHercegovina", "BosniaHerzegovina"}, {"Sofia", "SofijaGrad", "Bulgaria"}, {"Zagreb", "GradZagreb", "Croatia"}, {"Nicosia", "Nicosia", "Cyprus"}, {"Prague", "Prague", "CzechRepublic"}, {"Copenhagen", "Copenhagen", "Denmark"}, {"Tallinn", "Harju", "Estonia"}, {"Torshavn", "Stromo", "FaroeIslands"}, {"Helsinki", "Uusimaa", "Finland"}, {"Paris", "IleDeFrance", "France"}, {"Berlin", "Berlin", "Germany"}, {"Gibraltar", "Gibraltar", "Gibraltar"}, {"Athens", "Attiki", "Greece"}, {"SaintPeterPort", "SaintPeterPort", "Guernsey"}, {"Budapest", "Budapest", "Hungary"}, {"Reykjavik", "Hofudhborgarsvaedhi", "Iceland"}, {"Dublin", "Dublin", "Ireland"}, {"Douglas", "Douglas", "IsleOfMan"}, {"Rome", "Lazio", "Italy"}, {"SaintHelier", "SaintHelier", "Jersey"}, {"Pristina", "Pristina", "Kosovo"}, {"Riga", "Riga", "Latvia"}, {"Vaduz", "Vaduz", "Liechtenstein"}, {"Vilnius", "Vilniaus", "Lithuania"}, {"Luxemburg", "Luxembourg", "Luxembourg"}, {"Skopje", "Skopje", "Macedonia"}, {"Valletta", "Valletta", "Malta"}, {"Chisinau", "Chisinau", "Moldova"}, {"MonacoVille", "Monaco", "Monaco"}, {"Podgorica", "Podgorica", "Montenegro"}, {"Amsterdam", "NoordHolland", "Netherlands"}, {"Oslo", "Oslo", "Norway"}, {"Warsaw", "Mazowieckie", "Poland"}, {"Lisbon", "Lisboa", "Portugal"}, {"Bucharest", "Bucharest", "Romania"}, {"SanMarino", "SanMarino", "SanMarino"}, {"Belgrade", "CentralSerbia", "Serbia"}, {"Bratislava", "Bratislavsky", "Slovakia"}, {"Ljubljana", "Osrednjeslovenska", "Slovenia"}, {"Madrid", "Madrid", "Spain"}, {"Longyearbyen", "Svalbard", "Svalbard"}, {"Stockholm", "Stockholm", "Sweden"}, {"Bern", "Bern", "Switzerland"}, {"Kiev", "Kiev", "Ukraine"}, {"London", "GreaterLondon", "UnitedKingdom"}, {"VaticanCity", "VaticanCity", "VaticanCity"}}

$\endgroup$
1
  • $\begingroup$ Thank you, that's what I was looking for. But, actually, there should be "Name" instead of "CanonicalName". $\endgroup$
    – Camillus
    Commented Oct 20, 2020 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.