Skip to main content

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.

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.2.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.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bblocks-2.2.0.tar.gz
Algorithm Hash digest
SHA256 524227ec0c4a0ae0640501c0a1bf961d444a8c32118bcedff1c030894f4c0e22
MD5 fecc65e08b09f6d8950b2a9f1a4fa871
BLAKE2b-256 73c4907568861a65fd3a40191f59c35e9cf3c40e6cdb1375716dc555220b5f2c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bblocks-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bblocks-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 443ea7165224f9fcbf8a4245855a5b81246d612a9533d34c85edd86387b50f49
MD5 f010e4846824b58ccc35be4195a9a0a8
BLAKE2b-256 4c8ad4ec99403a15d46acd317051b9f46106f8766a3ef1a5431f9af24b7fca9a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 files

2.1.0

2 files

2.0.0

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.0.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page