I am working on computing the 20 largest cities in California.

enter image description here

  List[Rule[EntityProperty["City", "AdministrativeDivision"], 
     List["California", "UnitedStates"]]], 
   Rule[EntityProperty["City", "Population"], TakeLargest[20]]]]]

I do not understand what I am doing wrong here. Can someone help me figure this out?

  • $\begingroup$ No specific answer here. Tried a few things. But here's an alternate solution (suggested by W|A queried for "cities in California"): GeoEntities[Entity["AdministrativeDivision", {"California", "UnitedStates"}], "City"] $\endgroup$
    – b3m2a1
    Dec 6, 2021 at 4:16
  • $\begingroup$ I don't think you're doing anything wrong here, I think this might be a bug. $\endgroup$
    – Greg Hurst
    Dec 6, 2021 at 13:39

1 Answer 1

citiesCalifornia = 
   Entity["AdministrativeDivision", {"California", "UnitedStates"}], 

abc = EntityList[
    "Population" -> "Descending"]][[1 ;; 20]]

enter image description here


After the comment by OP: I ran the same procedure on cities in Texas which on my machine [Win7/x64/8Gb/rot HD/ (old machine) Mma 12.2.0] took 85.4s for the first time the entities were being read. The second time around it took a few seconds.

enter image description here

  • 1
    $\begingroup$ GeoEntities takes a long to run. Absolute Timing for Texas which I'm also interested in returned 124.7 seconds. That is too long for one state if I am going to run my program over all 50 states. Maybe I could select only the cities in the UnitedStates and run the program on those? $\endgroup$ Dec 6, 2021 at 13:12
  • $\begingroup$ If it runs slowly the first time, we can conclude or surmise that it is busy retrieving data. If it runs slowly the second time, then I wouldn't know how to explain it. $\endgroup$
    – Syed
    Dec 6, 2021 at 13:27

Your Answer

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

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