Metadata-Version: 2.4
Name: rhowb
Version: 1.0.2
Summary: Data from world bank api
Author-email: rhozhang <rhozhang@163.com>
License-Expression: MIT
Project-URL: Homepage, https://gitee.com/rhozhang/rhowb
Project-URL: Issues, https://gitee.com/rhozhang/rhowb/issues
Keywords: world bank,data
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: polars
Dynamic: license-file

# World Bank Data Api

## Income Levels

WB assigns its economies to four income groups: low, lower-middle, upper-middle, and high. The classifications are updated each year on July 1, based on the GNI per capita of the previous calendar year. For example, the updated income classifications for FY2025, based on the GNI per capita of 2023.

GNI measures are expressed in US dollars using conversion factors derived according to the Atlas method. WB's income classification aims to reflect an economy’s level of development, drawing on Atlas GNI per capita as a broadly available indicator of economic capacity.

The classification of countries into income categories has evolved significantly over the period since the late 1980s. In 1987, 30% of reporting countries were classified as low-income and 25% as high-income countries. Jumping to 2023, these overall ratios have shifted down to 12% in the low-income category and up to 40% in the high-income category.

| FY    | LIC      | LMC            | UMC              | HIC          | Data for Calendar Year |
|:-----:|----------|----------------|------------------|--------------|------------------------|
| 2026  | <= 1135  | [1136, 4495]   | [4496, 13935]    | > 13935      | 2024                   |
| 2025  | <= 1145  | [1146, 4515]   | [4516, 14005]    | > 14005      | 2023                   |   
| 2024  | <= 1135  | [1136, 4465]   | [4466, 13845]    | > 13845      | 2022                   |
| 2023  | <= 1085  | [1086, 4255]   | [4266, 13205]    | > 13205      | 2021                   |
| 2022  | <= 1045  | [1046, 4095]   | [4096, 12695]    | > 12695      | 2020                   |
| 2021  | <= 1035  | [1036, 4045]   | [4046, 12535]    | > 12535      | 2019                   |
 
```
from wbdata import WB
wb = WB()
wb.incomelevels
```

## Lending Types

```
wb.lendingtypes
```

## Sources

By default, sources are read from local file. To get the latest sources from World Bank API, use:

```
wb.getsources(False)
```

## Regions

WB groupes its members into one of seven geographic regions:

- East Asia and Pacific
- Europe and Central Asia
- Latin America and the Caribbean
- Middle East and North Africa
- North America, South Asia
- Sub-Saharan Africa

Region info data are read from local file by default. To get the latest regions from World Bank API, use:

```
wb.getregions(False)
```

## Topics

Topic data are read from local file by default. To get the latest topics from World Bank API, use:

```
wb.gettopics(False)
```

## Query Economy's Information

name, id, region, incomelevel, lendingtype, capital, longitude, latitude, ...

Parameters used frequently (at least ONE of them):

- name
- region
- incomelevel
- lendingtype

```
wb.queryecons(name = 'China')   # info of China
wb.queryecons(region = 'EAS', incomelevel = 'HIC')   # high income economies in East Asia and Pacific
```

## Query Indicators

By default, indicators are queried from local file 

```
wb.queryinds(name = 'GDP Per Capita')
```

## Get Data

```
wb.getdata('NY.GDP.MKTP.KD', 'CHN', period = '2020:2024')
```
