Wolfram 语言

外部服务

分析南美国家的恶性通货膨胀率

连接到 Federal Reserve Economic Data API.

In[1]:=
Click for copyable input
fred = ServiceConnect["FederalReserveEconomicData"]
Out[1]=

获取南美国家的名单.

In[2]:=
Click for copyable input
countries = CountryData["SouthAmerica"];

从所选国家中检索通胀率时间序列.

In[3]:=
Click for copyable input
data = Association[DeleteMissing[Block[{source, id, ts, fts}, source = fred["SeriesSearch", "Query" -> # <> " inflation consumer price"]; If[Length[source] > 0, (id = source[1, "ID"]; ts = fred["SeriesData", "ID" -> id]; fts = TimeSeries[ts , MissingDataMethod -> Automatic]; # -> fts), Missing[#]] ] & /@ (EntityValue[#, "Name"] & /@ countries)]];

制作在 1960-2015 年期间发生恶性通货膨胀的国家的图形.

显示完整的 Wolfram 语言输入
In[4]:=
Click for copyable input
hyperinflation = Select[data, (Max[#["Values"]] > 1000 &)]; DateListLogPlot[Thread[Legended[Values[#], Keys[#]]] &@hyperinflation, Filling -> Axis, FrameStyle -> White, FrameLabel -> "Logscale of inflation", FrameTicks -> {{Automatic, None}, {Table[DateObject[{i}], {i, 1960, 2015, 5}], None}}, PlotRange -> Full, Background -> RGBColor[0.25, 0.25, 0.25], AspectRatio -> 1/2, DateTicksFormat -> "YearShort", ImageSize -> 480, GridLines -> {None, {{10, White}, {100, Pink}, {1000, Red}}}, GridLinesStyle -> {Thickness[Small], Dashed}]
Out[4]=

相关范例

de en es fr ja ko pt-br ru