4
$\begingroup$

Can anyone tell me why the GDP property of CountryData would be different because of syntax?

{QuantityMagnitude[CountryData["NewZealand", "Population"]] == 
  QuantityMagnitude[ Entity["Country", "NewZealand"]["Population"]],
 QuantityMagnitude[CountryData["NewZealand", "GDP"]] == 
  QuantityMagnitude[ Entity["Country", "NewZealand"]["GDP"]]}
(* {True, False} *)
$\endgroup$
7
$\begingroup$

It appears that, as of this writing, CountryData is out of date.

CountryData["NewZealand", "GDP", "Date"]
2014

Whereas

EntityValue[Entity["Country", "NewZealand"], "GDP", "Date"]
DateObject[{2016}, "Year", __]

That being said, it seems that CountryData and Entity "Country" have some other differences.

CountryData["NewZealand", "GDP"]
$ 1.9997*10^11 per year

but

EntityValue[
 Entity["Country", "NewZealand"], 
 EntityProperty["Country", "GDP", {"Date" -> DateObject@{2014}}]]
$ 2.00696*10^11 per year

Even when specifying other "CurrencyUnit"s Entity "Country" does not return CountryData's value for 2014.

cu = "CurrencyUnit" /. 
   EntityValue[EntityProperty["Country", "GDP"], "QualifierValues"];

EntityValue[
    Entity["Country", "NewZealand"], 
    EntityProperty["Country", "GDP", 
     {"Date" -> DateObject@{2014}, "CurrencyUnit" -> #}]
] & /@ cu // Column
$ 1.62376*10^11 per year
Missing[NotAvailable]
$ 225351398500 per year
$ 241926000000 per year
$ 2.00696*10^11 per year

Since Entity "Country" has a "Source" annotation.

EntityValue[Entity["Country", "NewZealand"], "GDP", "Source"]
Entity["Source", "WorldDevelopmentIndicatorsWorldBank"]

I would suggest using Entity "Country" as you know where the data is from with this option. You can return the entire time series with

EntityValue[Entity["Country", "NewZealand"], 
 EntityProperty["Country", "GDP", {"Date" -> All}]]

Also, please report this issue to WRI.

Hope this helps.

Well, after looking at "Population" I think it may be a case of Entity "Country" "GDP" being more recent. "Population" for both is for year 2014. However, this still does not explain why the 2014 "GDP" values don't agree between the two.

$\endgroup$
  • $\begingroup$ Thanks - I have no idea how to file an issue with WRI. $\endgroup$ – Joe Jan 7 '18 at 4:00
  • $\begingroup$ @Joe Select Help | Give Feedback ... from the menu. $\endgroup$ – Edmund Jan 7 '18 at 20:08
0
$\begingroup$

Download CSV files from here

data = Import[
   "/Users/roberthanlon/Downloads/API_NY/API_NY.GDP.MKTP.CD_DS2_en_csv_v2.\
csv"];

data[[1 ;; 3]]

(* {{"Data Source", "World Development Indicators", 
  ""}, {}, {"Last Updated Date", "2017-12-22", ""}} *)

nzGDP = DeleteCases[
   Transpose[{data[[5, 5 ;;]], 
     Select[data[[6 ;;]], #[[1]] == "New Zealand" &][[1, 
       5 ;;]]}], {___, _?(! NumericQ[#] &)}];

nzGDP[[-3 ;;]]

(* {{2014, 2.00696*10^11}, {2015, 1.75563*10^11}, {2016, 1.84969*10^11}} *)

ListPlot[Tooltip /@ nzGDP]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Why not just use ts=EntityValue[Entity["Country", "NewZealand"], EntityProperty["Country", "GDP", {"Date" -> All}]]; DateListPlot[ts, Joined->False]? $\endgroup$ – Edmund Jan 6 '18 at 21:25
  • $\begingroup$ @Edmund - There appeared to be some concern over the currency of the data so i went to the data source. $\endgroup$ – Bob Hanlon Jan 6 '18 at 23:11

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.