13
$\begingroup$
CountryData[ "UnitedStates", {"Population", 2014} ]

322 422 965 people

CountryData[ "UnitedStates", {"Population", 2015} ]

Missing[ "NotAvailable" ]

How can I update it? I am new to Mathematica.

$\endgroup$
  • 1
    $\begingroup$ Both statistics and its implementation in Mathematica are slow. Lags usually equal few years. WolframAlpha in my Mma through ==Population of United States in 2015 answers 320 million people (2015 estimate). $\endgroup$ – user64494 Jan 17 at 15:55
  • 1
    $\begingroup$ Also WA in my Mma answers 327 million people (world rank: 3^(rd)) (2018 estimate) $\endgroup$ – user64494 Jan 17 at 16:35
  • $\begingroup$ @user64494 That is interesting, WolframAlpha[ "Population of the United States"] for me returns 324 million people (2017 estimate). Seems like there are different data bases queried? $\endgroup$ – gwr Jan 17 at 17:04
  • $\begingroup$ @gwr: Your question should be addressed to Wolfram developers, not to me. Try WolframAlpha["Population of the United States in 2018"]. Good luck! $\endgroup$ – user64494 Jan 17 at 17:12
  • $\begingroup$ @user64494 But you indeed have given the answer! Specifically asking for the population in 2018 will give the value you have given. It simply will not appear just asking for population for some reason. :) $\endgroup$ – gwr Jan 17 at 17:15
15
$\begingroup$

CountryData does appear to be out of date, and that is a shame. Many of the XXXData functions now act as wrappers to call EntityValue. Run TracePrint[PlanetData["Venus", "AngularDiameterFromEarth"],_EntityValue] to see that this is true.

But CountryData has not been updated to work this way. So we can call EntityValue directly for the data. To find out what the right syntax would be I will use Ctrl=:

enter image description here

becomes

enter image description here

which is a formatted form of

Entity["Country", "UnitedStates"][
    EntityProperty["Country", "Population", {"Date" -> DateObject[{1978}]}]
] 

I can query for a date range as well. Using Ctrl= on "US population 2000 through 2018" returns this input expression:

Entity["Country", "UnitedStates"][
    EntityProperty["Country",
        "Population",
        {"Date" -> Interval[{DateObject[{2000}], DateObject @ {2018}}]}
    ]
] 

which returns a TimeSeries object suitable for further computation or visualization.

$\endgroup$
10
$\begingroup$

You should report to WRI. As a workaround you may use the entity functions instead; it is a bit verbose.

First you can get a list of qualifier values of an EntityProperty by

EntityValue[EntityProperty["Country", "Population"], "QualifierValues"]
{Age->{Adult,MiddleAge,PreSchool,SchoolAge,Senior,Young,YoungAdult},
 CitizenshipStatus->{BornInPuertoRico,BornInUS,BornToAmericanParents,NaturalizedCitizen,NotCitizen,TotalCitizens},
 Date->{},
 Gender->{Female,Male},
 HispanicOrigin->{Argentinean,Bolivian,CentralAmerican,Chilean,Colombian,CostaRican,Cuban,Dominican,Ecuadorian,Guatemalan,Hispanic,HispanicOrLatinoAllOther,Honduran,Mexican,Nicaraguan,NotHispanic,OtherCentralAmerican,OtherHispanicOrLatino,OtherSouthAmerican,Panamanian,Paraguayan,Peruvian,PuertoRican,Salvadoran,SouthAmerican,Spaniard,Spanish,SpanishAmerican,Uruguayan,Venezuelan},
 MarginOfError->{MarginOfError,StandardError},
 Percent->{Main},
 Race->{AmericanIndian,Asian,Black,NativeHawaiian,Other,TwoOrMore,White,{All,Hispanic}},
 TwoOrMore->{ThreeOrMore,TwoIncludingOther},
 UrbanRural->{Rural,Urban}}

"Date" is a qualifier. This post gives details on how to specify a "Date" qualifier (156014); an area where the docs can improve.

EntityValue[
 Entity["Country", "UnitedStates"],
 EntityProperty["Country", "Population", {"Date" -> DateObject[{2015}]}]
 ]
319,929,162 people

However, you do have a bit more flexibility with this syntax.

EntityValue[
 Entity["Country", "UnitedStates"],
 EntityProperty["Country", 
  "Population", {"Date" -> Interval[{DateObject[{2015}], DateObject[{2019}]}]}]
 ]

Mathematica graphics

and

EntityValue[
 Entity["Country", "UnitedStates"],
 EntityProperty["Country", "Population", {"Date" -> All}]
 ]

Mathematica graphics

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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