Skip to main content

Building blocks for development data.

Project description

bblocks

Building Blocks for development data work

PyPI PyPI - Python Version Docs Code style: black

bblocks is a growing collection of Python packages designed to simplify the everyday work of analysts and researchers in the international development sector. Built with usability and modularity in mind, bblocks provides reliable, reusable components that help standardize and streamline data workflows—from data cleaning and transformation to country concordance, dataset importation, and integration with ETL pipelines such as Data Commons.

Whether you're wrangling data for a quick analysis or developing a robust, production-ready pipeline, bblocks offers practical, tested tools that are easy to plug into your workflow and scale with your needs.

Read the documentation for more details on how to use bblocks packages and the motivation for their creation.

Packages

bblocks is an umbrella package that includes several specialized sub-packages, each designed to address specific data tasks.

  • bblocks-places: Resolve and standardize place names, including countries, regions, and other geographic entities.
  • bblocks-data-importers: Tools to import data from different international development sources such as IMF, World Bank and many others.

Installation

It’s easy to get started with bblocks. Whether you want the full distribution or only specific tools, installation is flexible and straightforward.

Install the entire bblocks toolkit

This is recommended for most users who want access to all the tools in the bblocks ecosystem.

pip install bblocks[all]

Install specific bblocks packages

Install only the packages you need without unnecessary dependencies. For example, to install the places package:

pip install bblocks[places]

You can also install individual packages directly:

pip install bblocks-places

Basic Usage

Once installed, you can start using bblocks packages in your analysis pipelines. Here's a quick example of fetching some data using th bblocks-data-importers and resolving entity names with bblocks-places:

from bblocks.data_importers import WorldBank
from bblocks import places

# Fetch World Bank data for series "SI.POV.DDAY" (poverty headcount ratio at $3.00 a day)
wb = WorldBank()
df = wb.get_data(series="SI.POV.DDAY")

# Resolve entities to short names
df["country"] = places.resolve_places(df["entity_name"], to="name_short", not_found="ignore")

# filter for African countries
gdp_africa = places.filter_african_countries(df["country"])

# Keep only relevant columns
gdp_africa = gdp_africa.loc[:, ["year", "country", "value",]]

# preview the results
print(gdp_africa.head())
# Output:
#       year    country     value 
# 0     1988    Algeria     12.3
# 1     1995    Algeria     11.8
# 2     2011    Algeria     0
# 3     2000    Angola      27
# ...

Contributing

We welcome contributions to bblocks! If you have ideas for new packages, improvements, or bug fixes, please check out our contributing guidelines for details on how to get involved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bblocks-2.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bblocks-2.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file bblocks-2.1.0.tar.gz.

File metadata

  • Download URL: bblocks-2.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bblocks-2.1.0.tar.gz
Algorithm Hash digest
SHA256 8f4efbb04585865ed513e8673080b8dc3db625fde63b2ef63423855957c533c1
MD5 dbd0727dfd479fdf8360673423606d30
BLAKE2b-256 6ddddfd86414b7b3026c651b41576be4b59bd4f7aa1efff94c0323cfca0b4332

See more details on using hashes here.

File details

Details for the file bblocks-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: bblocks-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bblocks-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d996f82c9c359095fbea725bf43023cbef281b66fa4f3afc9d7f6dea5a05a3
MD5 0359f4bebcc5bb90f6e9483badf52c82
BLAKE2b-256 d3d1f03c278f3e7c11b57c7401890caf041c2e5170d4adb28650479b7642df24

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page