Skip to main content

US (American) public-library funding, usage, and operations + community civics data (1992–2023) — integrated from IMLS, Census, and HUD into one tidy `facts` table.

Project description

🐝 libbee

PyPI Version Python Version License Ruff Style Test Coverage

An unofficial Python package for US public library and community civics data.

libbee consolidates over 30 years of public data into a single, unified, cleanly structured facts table. It pulls from four primary data sources:

  • IMLS (Institute of Museum and Library Services): The authoritative Public Libraries Survey (PLS) tracking funding, visits, staff, and circulation for every library system in America (1992–2023).
  • US Census Bureau (ACS): The American Community Survey 5-Year estimates, supplying cross-sectional community need metrics like median household income, poverty rates, and broadband access.
  • HUD (Dept. of Housing and Urban Development): Point-in-Time (PIT) estimates and Continuum of Care (CoC) funding awards, providing local homelessness statistics.
  • California State Library (LibPAS): Highly detailed annual library statistics and budget allocations specifically for California library systems.

Why does this exist?

Working directly with the raw source data for public libraries is notoriously painful. If you try to do this from scratch, you have to deal with:

  • Shifting schemas: Over 32 years, column names shift constantly (e.g., HOURS to OP_HRS to HRS_OPEN).
  • Silent data corruption: Missing fields use arbitrary negative numeric codes (-1, -3, -9) instead of standard nulls. If loaded directly, these ruin your sums and averages.
  • Geospatial nightmares: Joining library panel data against Census or HUD datasets requires cross-walking mismatched boundaries.
  • Formatting mess: The raw data is scattered across 100+ MB of ASCII, Windows-1252, and UTF-8 encoded ZIPs, DBFs, and binary Excel files.

libbee automates the downloading, cleaning, and conforming. It maps the entities, fixes the nulls, normalizes the encodings, and packs everything into fast, columnar Parquet tables (via Polars/PyArrow) that take up about 11 MB on disk. (Note: the raw data assets may be upwards of 200MB total.)

Install

pip install libbee                 # Core data loading
pip install "libbee[analysis]"     # Adds scikit-learn, statsmodels, shap
pip install "libbee[duckdb]"       # Adds DuckDB SQL engine
pip install "libbee[notebook]"     # Adds interactive marimo dashboard
pip install "libbee[all]"          # Everything

Note: Python ≥ 3.11 is required. The package ships code-only; data is built and cached locally.

Quickstart

Because we don't ship the raw data in the wheel, you need to build the local cache once:

# Downloads, cleans, and caches everything (takes a minute or two)
libbee build

Then, use it in Python:

import libbee
import polars as pl

# 1. Load the unified facts table (720k+ rows, conformed to one schema)
df_facts = libbee.facts()

# 2. Or query a specific conformed frame
df_equity = libbee.load("county_equity")

# 3. Use lazy evaluation for fast filtered queries
lf = libbee.scan("facts")
df_summary = (
    lf.filter(
        (pl.col("geo_level") == "state") &
        (pl.col("metric") == "visits_pc") &
        (pl.col("year") == 2019)
    )
    .sort("value", descending=True)
    .collect()
)

Documentation & Advanced Usage

Looking for the Data Dictionary, DuckDB integration, inflation adjustments, or analysis examples (like Difference-in-Differences models)?

👉 Read the Docs

Citation & License

When using these conformed datasets in publications, please cite the primary publishing agencies: IMLS (Public Libraries Survey), US Census Bureau (ACS), HUD (PIT/CoC), and the CA State Library.

Licensed under the MIT License.

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

libbee-0.0.7.tar.gz (227.9 kB view details)

Uploaded Source

Built Distribution

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

libbee-0.0.7-py3-none-any.whl (210.8 kB view details)

Uploaded Python 3

File details

Details for the file libbee-0.0.7.tar.gz.

File metadata

  • Download URL: libbee-0.0.7.tar.gz
  • Upload date:
  • Size: 227.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libbee-0.0.7.tar.gz
Algorithm Hash digest
SHA256 0728ebd89ef98907225da2d4c03e2985de1d66d75b8ffdc7c23ef3067849d6bb
MD5 23adcf2c6d0f00285e1b940b9e1b0d3b
BLAKE2b-256 a34ee29adffea81ccb9fe58b3e1c7feecdf22abc778c3961c777e85ddca95da4

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbee-0.0.7.tar.gz:

Publisher: publish.yml on postphotos/libbee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libbee-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: libbee-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 210.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libbee-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 882c745936da2027e4c9431fe24dc4d88245a4980b8d51632233b978e103c6cb
MD5 dbe91c0162f5bb3fe6d379b20a21c83b
BLAKE2b-256 150e25aa7524c5b00bf883b4a37e3dae904ceecdececdcc9ebc0ecb23e04b58b

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbee-0.0.7-py3-none-any.whl:

Publisher: publish.yml on postphotos/libbee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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