5
$\begingroup$

Is it possible to get CityData for different years? Or get a year of origin of data in CityData?

$\endgroup$

3 Answers 3

7
$\begingroup$

There is new functionality in 10.3 called EntityInstance.

nyc1890 = 
  EntityInstance[
   Entity["City", {"NewYork", "NewYork", "UnitedStates"}], 
   "Date" -> 1890];
nyc1890["Population"]
(*Quantity[1515301, "People"]*)

nyc2015 = 
 EntityInstance[
  Entity["City", {"NewYork", "NewYork", "UnitedStates"}], 
  "Date" -> 2015];
nyc2015["Population"]
(*Quantity[8491079, "People"]*)

Lets Graph the population trend.

ListPlot[{#, 
    EntityInstance[
      Entity["City", {"NewYork", "NewYork", "UnitedStates"}], 
      "Date" -> #]["Population"]} & /@ Range[1890, 2015, 5], 
 Joined -> True, PlotLabel -> "NYC Population", 
 PlotTheme -> "Detailed", FrameLabel -> {"Year", "Population"}]

enter image description here

$\endgroup$
4
$\begingroup$

You can get the year of origin with f.e.

CityData["Seattle", "Population", "Date"]

2004

Unlike f.e. TemperatureData you can't get CityData for different years.

However, you can make a WolframAlpha query which will give you some historical data.

For example

 data=
   WolframAlpha["Seattle", {{"Population:CityData", 3}, "ComputableData"}, 
      PodStates -> {"Population:CityData__Show history"}]

enter image description here

DateListPlot @ data

enter image description here

$\endgroup$
4
$\begingroup$
CityData["London", "Population", "Date"]

(*  2004  *)

CityData["London", "Population"]

(*  Quantity[8173941, "People"]  *)

WolframAlpha query via Mathematica indicates that the city population for London is a 2011 estimate (no base for estimate given) -- but agrees roughly (8.174 million people) with the (2004?) value returned by CityData; whereas, the London metro area population is a 2007 estimate (no base for estimate given). I would conclude that the CityData is neither current nor accurate.

WolframAlpha["city population of London"]

enter image description here

$\endgroup$

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.