SCL Data - Data Ecosystem Working Group
The objective of this library is to help users access standardized SCLdata indicators on topics such as poverty, inequality, health, labor market, gender and diversity, education, and migration for the 26 countries of the region.
The project to develop the library in Python resulted from the implementation workshop for IDBSocialData. Individual developers showed interest in the library in Python and decided to collaborate voluntarily with the IDB to develop this tool.
To install the idbsocialdatapy library you can use:
$ pip install idbsocialdatapy
There are many indicators in this library, with the metadata functions you will be able to find all the indicators we have available.
Get the dictionary for all the indicators in our API.
import idbsocialdatapy as idb
dictionary = idb.query_dictionary()
- See available countries with iso-codes and regions.
- See themes included in our indicators. For instance, labor markets, education, and social protection.
- Review the sources we use to construct our indicators.
countries = idb.get_countries()
themes = idb.get_themes()
sources = idb.get_sources()
This is the main function of the library. With this function, you will be able to query all the indicators from our API. The function has four main inputs.
-
indicator: needed. Pick one or multiple indicators to query.
-
categories: optional. If no category is chosen, you will get the indicator for the total population. The categories you can pick from are the following:
categories | comments |
---|---|
sex | women or men |
quintile | indicator for different income quintiles |
area | urban or rural |
age | indicators for populations with different ages |
ethnicity | afro descendants, indigenous and non-afro non-indigenous |
disability | indicators for the population living with and without disabilities |
migration | migrant or non-migrant |
- countries: optional. If you do not pick a category, you will get the information for all the countries available for that indicator. If you want to pick specific countries you will do so with the isoalpha3 code. You can get the isoalpha3 code for all the countries from the following function:
countries = idb.get_countries()
- yearstart: and yearend: optional. You can use these arguments if you want to limit the years you get data from.
Here is an example using all the arguments. We will query the poverty indicators, disaggregated by gender, for Mexico, Colombia, and Brasil, for the period between 2005 and 2020.
poverty = idb.query_indicator(indicator = 'pobreza', # define indicator to consult
categories = 'sex', # define category/ies I want to see in the indicator
countries = 'COL,BRA,MEX', #define countries you want data from
yearstart = '2005', # starting period
yearend = '2021') # ending period
idbsocialdatapy's original authors are:
- Genrry Hernández
- Juan Pablo Zorrilla Salgador
- Elena Fernández López
- María Reyes Retana Torre
- Sergio Andrés Herrera Velásquez
- Juan Villa Hernández
Copyright © 2020. Banco Interamericano de Desarrollo ("BID"). Uso autorizado. AM-331-A3