Eurostatx

An Elixir client for the Eurostat APIs, the open data services of the statistical office of the European Union.

Everything Eurostat publishes — national accounts, prices, jobs, energy, population, trade — is in free APIs that need no key. Eurostatx covers all of them, validates the options before making the request and turns the answers into Explorer data frames, ready to analyse or to plot in Livebook.

This page is a demo: the countries of the Union side by side, with figures asked of Eurostat with Eurostatx and drawn with Apache ECharts. Under each chart is the call that fetched it.

{:eurostatx, "~> 0.1"}

Population pyramid

People living in the EU by sex and age, from 0 to 99, on 1 January of the latest year published.

In plain words. A population pyramid stacks people by age: the youngest at the bottom, the oldest at the top, men on the left and women on the right. A young country really is shaped like a pyramid. An ageing one, like the EU, is wider in the middle than at the base.

Asking Eurostat…
Eurostatx.Statistics.data_as_data_frame!("demo_pjan",
  filters: [geo: "EU27_2020", sex: ["M", "F"], unit: "NR"],
  last_periods: 1
)

Children per woman

Average number of children a woman would have at the fertility rates of the latest year. At 2.1 a population replaces itself.

In plain words. The number of children each woman would have over her life if births kept to this year's pace. Below 2.1, each generation is smaller than the one before, unless immigration makes up the difference.

Asking Eurostat…
eu = ~w(BE BG CZ DK DE EE IE EL ES FR HR IT CY LV LT LU HU MT NL AT PL PT RO SI SK FI SE)

Eurostatx.Statistics.data_as_data_frame!("demo_find",
  filters: [geo: ["EU27_2020" | eu], indic_de: "TOTFERRT"],
  last_periods: 2
)

Life expectancy

Life expectancy at birth, men and women together, in the latest year. The line is the EU as a whole.

In plain words. How many years a baby born this year would live on average if today's death rates stayed the same all its life. It sums up in one number how likely people are to die at each age.

Asking Eurostat…
eu = ~w(BE BG CZ DK DE EE IE EL ES FR HR IT CY LV LT LU HU MT NL AT PL PT RO SI SK FI SE)

Eurostatx.Statistics.data_as_data_frame!("demo_mlexpec",
  filters: [geo: ["EU27_2020" | eu], sex: "T", age: "Y_LT1", unit: "YR"],
  last_periods: 2
)

Data: © European Union, Eurostat, reusable under its copyright notice (CC BY 4.0). The page asks Eurostat for it one request at a time, as Eurostat asks, and keeps it for a few hours, so it always shows the latest figures published.

Map: Natural Earth, in the public domain.

Eurostatx is an independent open source project: it is not developed, endorsed or supported by Eurostat.