Message Boards Message Boards

0
|
5381 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Creating a dataset with CityData

Posted 9 years ago

Hello Everybody, I want to create a dataset with all cities that are greater than 4 Mio inhabitants. So i tried it with the command

EntityValue[EntityClass["City", {"Population" -> GreaterThan[Quantity[4000000, "People"]]}]]

but unfortunately this doesn't work. Has somebody an idea how to create such a dataset? Thanks for help :)

POSTED BY: Kristina Fuchs
2 Replies
Posted 9 years ago

Thank you so much for your help! It works :)

POSTED BY: Kristina Fuchs

Dear Kristina,

I know it is not a pretty nor very efficient solution but it does the job. If you need to run it just once it is probably enough:

Inh = 4 10^6;
cities = Select[CityData[All], 
  QuantityMagnitude[CityData[#, "Population"]] > Inh &]
citiesAndPopulation = {#, CityData[#, "Population"]} & /@ cities
Attachments:
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract