Expenditure to GDP
Get the Government Expenditure to GDP Ratio for a variety of countries over time from the Global Macro Database (GMDB). The Government Expenditure to GDP Ratio is the ratio of the total amount of money that a government spends on goods and services to the Gross Domestic Product (GDP).
Data comes from the Global Macro Database (GMDB), further information about the variable can be found within https://www.globalmacrodata.com/documentation.html
The ratio is expressed as a decimal fraction (0.3708 for 37.08% of GDP).
Changed in v2.2.0: this used to be returned in percentage points. It is now a decimal fraction, matching every other ratio in the Finance Toolkit.
Also known as: government spending to GDP.
Expenditure to GDP in Python
get_government_expenditure_to_gdp_ratio is part of the Economics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_government_expenditure_to_gdp_ratio as shown below.
from financetoolkit import Economics
economics = Economics(start_date='2015-01-01')
economics.get_government_expenditure_to_gdp_ratio(
countries=['United States', 'Japan', 'Netherlands'])
Which returns:
| United States | Japan | Netherlands | |
|---|---|---|---|
| 2015 | 0.3503 | 0.3729 | 0.4525 |
| 2016 | 0.3533 | 0.3723 | 0.4392 |
| 2017 | 0.3519 | 0.3669 | 0.4276 |
| 2018 | 0.3535 | 0.3674 | 0.4244 |
| 2019 | 0.3581 | 0.3729 | 0.421 |
| 2020 | 0.4457 | 0.4452 | 0.4781 |
| 2021 | 0.426 | 0.4244 | 0.4589 |
| 2022 | 0.3631 | 0.4184 | 0.4327 |
| 2023 | 0.3628 | 0.4116 | 0.432 |
| 2024 | 0.3753 | 0.422 | 0.4416 |
| 2025 | 0.3738 | 0.3983 | 0.448 |
| 2026 | 0.374 | 0.3963 | 0.4513 |
Parameters
get_government_expenditure_to_gdp_ratio accepts the following parameters:
- countries (list[str] | str | None, optional): A list of countries or a single country to include in the results. Defaults to None.
- rolling (int, optional): The rolling window size to use for smoothing the data (simple moving average). Defaults to None.
- trailing (int, optional): The trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). 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. 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.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.