5

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

3 Answers3

7

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

Zviovich
  • 9,308
  • 1
  • 30
  • 52
4

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

eldo
  • 67,911
  • 5
  • 60
  • 168
4
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

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198