Retrieves the life tables Eurostat compiles yearly for the countries of the European Economic Area, by single year of age from 0 to 95 (the last age group being 95 and over), from 1960 for most countries. A life table describes the mortality of a population: the basis of every pension, life insurance and annuity calculation, and of mortality and longevity assumptions in scenario models.

The measures are the probability of dying within the year (death_probability, qx), the probability of surviving it (survival_probability, px), the age-specific death rate (death_rate, mx), the number of survivors out of 100,000 births (survivors, lx), the number dying (deaths, dx), the person-years lived within the year (person_years, Lx) and above the age (total_person_years, Tx), and the life expectancy at the age (life_expectancy, ex). Probabilities and rates are fractions; the others are counts or years.

No API key is needed. For countries outside Europe the UN World Population Prospects publish life tables for every country (bulk files at population.un.org/wpp), and the Human Mortality Database long national histories (with free registration).

Also known as: mortality table, qx table, survival table, actuarial table.

Life Tables in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_life_table as shown below.

from financetoolkit import Economics

economics = Economics(start_date='2020-01-01', end_date="2025-12-31")

life_table = economics.get_life_table(countries='Germany', sex='male')

life_table['Germany'][[0, 30, 65, 80, 95]]

Which returns:

  0 30 65 80 95
2020 0.0032 0.0005 0.0156 0.0575 1
2021 0.0033 0.0006 0.0163 0.0559 1
2022 0.0032 0.0005 0.016 0.0596 1
2023 0.0033 0.0006 0.0153 0.0571 1
2024 0.0035 0.0005 0.0151 0.0566 1

Parameters

The function accepts the following parameters:

  • countries (list[str] | str | None, optional): The countries to include, e.g. ‘Germany’ or [‘Germany’, ‘France’]. Defaults to None, which retrieves every country.
  • measure (str, optional): The life table measure, see above. Defaults to “death_probability”.
  • sex (str, optional): “total”, “male” or “female”. Defaults to “total”.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
  • growth (bool, optional): Whether to return the growth data or the actual data. Defaults to False.
  • lag (int, optional): The number of periods to lag the growth data by. Defaults to 1.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
Share