CountryData[ "UnitedStates", {"Population", 2014} ]
322 422 965 people
CountryData[ "UnitedStates", {"Population", 2015} ]
Missing[ "NotAvailable" ]
How can I update it? I am new to Mathematica.
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=:
becomes
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.
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}]}]}]
]
and
EntityValue[
Entity["Country", "UnitedStates"],
EntityProperty["Country", "Population", {"Date" -> All}]
]
Hope this helps.
WolframAlpha[ "Population of the United States"]
for me returns 324 million people (2017 estimate). Seems like there are different data bases queried? $\endgroup$