Weo Package¶
Submodules¶
weo.dataframe module¶
Access WEO data as dataframe
from weo import WEO w = WEO(‘weo.csv’)
-
class
weo.dataframe.
WEO
(filename, id_column='ISO')¶ Bases:
object
Wrapper for pandas dataframe that holds World Economic Outlook country dataset.
Initialised by local filepath:
w = WEO(‘weo.csv’)
-
- .subjects
-
- .codes
-
- .core_codes
-
- .years
All-or-subsets inspection methods:
.variables()
.units()
.countries()
Country finders:
.iso_code3(country_name)
.iso_code2(country_name)
.country_name(country_code)
Single variable dataframe:
.get(subject, unit)
.getc(code)
Multiple variable dataframe:
.country(country_code)
.fix_year(year)
Variables:
.gdp_usd()
.current_account()
.libor_usd() and other
-
check_code
(code)¶
-
check_country
(iso_code)¶
-
check_subject
(subject)¶
-
check_unit
(subject, unit)¶
-
property
codes
¶
-
property
core_codes
¶
-
core_codes_describe
()¶
-
countries
(name=None)¶ List all countries or find country names that include name as substring. The search is case-insensitive.
-
country
(iso_code, year=None, compact=True)¶ - Must add:
exchange rate
plottable information
- See notes for:
net debt
-
country_name
(iso_code)¶ Return country name for ISO country code.
-
current_account
(*arg, year=None, start_year=None, end_year=None)¶
-
property
daterange
¶
-
exchange_rate
(year=None)¶
-
fix_year
(year)¶
-
from_code
(variable_code)¶ - Parameters
variable_code (str) –
-
gdp_growth
(*arg, year=None, start_year=None, end_year=None)¶
-
gdp_nc
(*arg, year=None, start_year=None, end_year=None)¶
-
gdp_pc_nc
(*arg, year=None, start_year=None, end_year=None)¶
-
gdp_pc_usd
(*arg, year=None, start_year=None, end_year=None)¶
-
gdp_ppp
(*arg, year=None, start_year=None, end_year=None)¶
-
gdp_usd
(*arg, year=None, start_year=None, end_year=None)¶
-
get
(subject, unit)¶ - Parameters
subject (str) –
unit (str) –
-
getc
(code)¶ - Parameters
code (str) –
-
gov_gross_debt_pgdp
(*arg, year=None, start_year=None, end_year=None)¶
-
gov_net_lending_pgdp
(*arg, year=None, start_year=None, end_year=None)¶
-
inflation
(*arg, year=None, start_year=None, end_year=None)¶
-
iso_code2
(country_name)¶ Return two-letter ISO code for country_name.
- Parameters
country_name (str) –
-
iso_code3
(country_name)¶ Return three-letter ISO code for country_name.
- Parameters
country_name (str) –
-
libor_usd
()¶
-
nlargest
(n=10, year=2018)¶
-
population
(*arg, year=None, start_year=None, end_year=None)¶
-
property
subjects
¶
-
t
(df, column)¶ Extract columns with years from df, make column an index.
-
to_code
(subject, unit)¶ - Parameters
subject (str) –
unit (str) –
-
units
(subject=None)¶
-
variables
(pattern=None)¶
-
property
years
¶
-
-
exception
weo.dataframe.
WEO_ParsingError
¶ Bases:
ValueError
-
weo.dataframe.
accept_year
(func)¶
-
weo.dataframe.
alpha3_to_2
(alpha3)¶ - Parameters
alpha3 (str) –
-
weo.dataframe.
convert
(x)¶
-
weo.dataframe.
read_csv
(filename)¶
-
weo.dataframe.
split_footnote
(s)¶
-
weo.dataframe.
version
(filename)¶
weo.dates module¶
-
class
weo.dates.
Date
(year: int, release: weo.dates.Release)¶ Bases:
object
-
release
: weo.dates.Release¶
-
year
: int¶
-
-
weo.dates.
all_releases
()¶ Provide all (year, release) pairs to use in bulk download.
- Return type
List[Tuple[int, int]]
-
weo.dates.
download
(year, release, filename=None, directory='.', fetch=<function curl>)¶ Download dataset from IMF WEO website by release.
from weo import download download(2020, ‘Oct’, ‘weo.csv’)
Equivalent to:
To download all releases (folder ‘weo_data’ must exist):
from weo import all_releases
- for (year, release) in all_releases():
download(year, release, directory=’weo_data’)
- Parameters
year (int) – Year of WEO release.
release (int or str) – For spring WEO release use 1 or ‘Apr’ For fall WEO release use 2, ‘Oct’ or (in 2011) - ‘Sep’.
filename (str) – Filename where to save file.
directory (str) – Directory where to write file.
fetch (callable, optional) – Used for testing.
- Returns
- Return type
path, url
-
weo.dates.
make_url_commodities
(d)¶ - Parameters
d (weo.dates.Date) –
-
weo.dates.
make_url_countries
(d)¶ - Parameters
d (weo.dates.Date) –