Get the Government Expenditure for a variety of countries over time from the Global Macro Database (GMDB). Government Expenditure is the total spending of the government: goods and services and the wages of its employees, but also social benefits and other transfers, subsidies and interest on its debt.

The level is annual and expressed in millions of national currency, so levels are not comparable across countries with different currencies, but growth rates are.

Data comes from the Global Macro Database (GMDB), further information about the variable can be found within https://www.globalmacrodata.com/documentation.html

Also known as: government spending, public expenditure.

Government Expenditure in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_government_expenditure as shown below.

from financetoolkit import Economics

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

economics.get_government_expenditure(countries=['Japan', 'China', 'India'])

Or, after setting up the Finance Toolkit MCP, ask:

How much did the governments of Japan, China and India spend each year, in national currency, from 2015 to 2025?

Which returns:

  Japan China India
2015 2.06691e+08 2.1786e+07 3.65765e+07
2016 2.08867e+08 2.41238e+07 4.12501e+07
2017 2.09092e+08 2.71281e+07 4.4235e+07
2018 2.10865e+08 3.05534e+07 4.91601e+07
2019 2.14548e+08 3.38067e+07 5.35377e+07
2020 2.47428e+08 3.6053e+07 6.12564e+07
2021 2.43415e+08 3.74577e+07 7.03345e+07
2022 2.41313e+08 4.02806e+07 7.82555e+07
2023 2.39074e+08 4.23663e+07 8.60877e+07
2024 2.43693e+08 4.44027e+07 9.31256e+07
2025 2.51507e+08 4.44552e+07 9.84739e+07

Parameters

get_government_expenditure accepts the following parameters.

ParameterTypeDescriptionExample
countrieslist[str] | str | NoneA list of countries or a single country to include in the results. Defaults to None.["United States", "Germany"]
levelstrThe government the figures cover: “consolidated” (the Global Macro Database’s combination of general and central government figures, with the longest history), “general” (general government: central, state and local government and social security) or “central” (central government only). Defaults to “consolidated”."general"
rollingintThe rolling window size to use for smoothing the data (simple moving average). Defaults to None.4
trailingintThe trailing window size to use for summing the data over trailing periods (e.g. a trailing-4-quarter sum). Defaults to None.4
growthboolWhether to return the growth data or the actual data. Defaults to False.True
lagintThe number of periods to lag the growth data. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None.2
gmdb_forecastsboolWhether to include the years the Global Macro Database projects, from the IMF’s World Economic Outlook, up to five years ahead. Only applies to data from the Global Macro Database. Defaults to False, which ends a series with its last observation.True
Share