API Reference
This page contains the API reference for the pippy package.
Main Functions
get_stats
Retrieve poverty and inequality statistics from the World Bank's PIP API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
country |
str
|
Country code or 'all' for all countries. Defaults to 'all'. |
'all'
|
year |
str or int
|
Year or 'all' for all years. Defaults to 'all'. |
'all'
|
povline |
float
|
Poverty line in PPP dollars per day. |
None
|
popshare |
float
|
Population share (0-100). |
None
|
fill_gaps |
bool
|
Whether to fill gaps in the data. Defaults to False. |
False
|
region |
str
|
Region code. |
None
|
welfare_type |
str
|
Type of welfare measure. Defaults to 'all'. |
'all'
|
reporting_level |
str
|
Level of reporting. Defaults to 'all'. |
'all'
|
ppp_version |
str
|
Version of PPP to use. |
None
|
release_version |
str
|
Release version of the data. |
None
|
format |
str
|
Format of the returned data. Defaults to 'json'. |
'json'
|
group_by |
str
|
Grouping option for the data. |
None
|
debug |
bool
|
Enable debug logging. Defaults to False. |
False
|
use_cache |
bool
|
Use cached data if available. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the requested statistics. |
Raises:
| Type | Description |
|---|---|
PIPAPIError
|
If the API request fails or returns unexpected data. |
Source code in pippy/stats.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
get_wb
Retrieve World Bank global/regional statistics from the PIP API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year |
str or int
|
Year or 'all' for all years. Defaults to 'all'. |
'all'
|
povline |
float
|
Poverty line in PPP dollars per day. |
None
|
ppp_version |
str
|
Version of PPP to use. |
None
|
release_version |
str
|
Release version of the data. |
None
|
format |
str
|
Format of the returned data. Defaults to 'json'. |
'json'
|
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the World Bank global/regional statistics. |
Raises:
| Type | Description |
|---|---|
PIPAPIError
|
If the API request fails or returns unexpected data. |
Source code in pippy/stats.py
Auxiliary Data Functions
get_countries
Retrieve a list of countries from the World Bank's PIP API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Additional keyword arguments to pass to get_aux(). |
{}
|
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the list of countries. |
Raises:
| Type | Description |
|---|---|
PIPAPIError
|
If the API request fails or returns unexpected data. |
Source code in pippy/auxiliary.py
get_regions
Retrieve a list of regions from the World Bank's PIP API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Additional keyword arguments to pass to get_aux(). |
{}
|
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the list of regions. |
Raises:
| Type | Description |
|---|---|
PIPAPIError
|
If the API request fails or returns unexpected data. |
Source code in pippy/auxiliary.py
get_cpi
Retrieve Consumer Price Index (CPI) data from the World Bank's PIP API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Additional keyword arguments to pass to get_aux(). |
{}
|
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: A DataFrame containing the CPI data. |
Raises:
| Type | Description |
|---|---|
PIPAPIError
|
If the API request fails or returns unexpected data. |
Source code in pippy/auxiliary.py
For more detailed information about each function and its parameters, please refer to the source code documentation.