7
$\begingroup$

I am using v12.2.0-Win7-x64.

CityData[Entity[
  "City", {"Shanghai", "Shanghai", "China"}], "Population"]

Quantity[14007000, "People"]

Entity["City", {"Shanghai", "Shanghai", "China"}]["Population"]

Quantity[24152700, "People"]


enter image description here

Question

Am I using these correctly? Why is there (such) a difference? Thanks for your help as always.

$\endgroup$
7
  • 1
    $\begingroup$ Spot checking a few cities, I'm seeing that EntityValue consistently gives a higher population than CityData. Maybe CityData adheres strictly to some sort of city boundary and EntityValue corresponds to a more informal concept of "city" that extends to surrounding areas? $\endgroup$
    – lericr
    Sep 28, 2022 at 16:39
  • 1
    $\begingroup$ AdministrativeDivisionData[{"Shanghai", "China"}, "Population"] gives about 23 million, which is closer to but still less than EntityValue[Entity["City", {"Shanghai", "Shanghai", "China"}], "Population"] $\endgroup$
    – lericr
    Sep 28, 2022 at 16:43
  • $\begingroup$ For Entity["City", {"Shanghai", "Shanghai", "China"}], I searched if there were "Metro Area" / "Suburban" population properties etc. but that attempt was not successful. $\endgroup$
    – Syed
    Sep 28, 2022 at 16:52
  • 1
    $\begingroup$ "PopulationDensity" is the same for both methods. That seems weird given that total population differs. $\endgroup$
    – lericr
    Sep 28, 2022 at 17:32
  • $\begingroup$ I sort of expected for someone with expertise in the Entity system to weigh in here. Since no one has, does it seem worth reporting the issue to Wolfram? $\endgroup$
    – lericr
    Sep 28, 2022 at 18:11

1 Answer 1

5
$\begingroup$

THIS IS AN EXTENDED COMMENT

$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global`*"]

With[{city = Entity["City", {"Shanghai", "Shanghai", "China"}]},
 Column@{
   CityData[city, "Population"],
   city["Population"],
   city[EntityProperty["City", "Population"]]}]

enter image description here

The different data values appear to represent data for different dates.

(pop = Table[{yr, 
     Entity["City", {"Shanghai", "Shanghai", "China"}][
      Dated["Population", yr]]}, {yr, 2000, 2021}]) // Grid

enter image description here

The older data appears to be either interpolated or extrapolated. Newer data appears only to be occasionally updated.

$\endgroup$
1
  • $\begingroup$ Excellent! I wasn't familiar with Dated. I have previously had vague misgivings about entity properties without dates, but don't use entities enough to have stumbled on Dated. Thanks! $\endgroup$
    – lericr
    Sep 28, 2022 at 20:51

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.