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
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.,
HOURStoOP_HRStoHRS_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.
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)?
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libbee-0.0.2.tar.gz.
File metadata
- Download URL: libbee-0.0.2.tar.gz
- Upload date:
- Size: 116.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bcaf4735400a4dca91102253fc1202bd193443d6cb0a572fbbccde72f6c2cb8
|
|
| MD5 |
7ac3025bface458fcd2d0f71e0fa5da2
|
|
| BLAKE2b-256 |
5014ee9030e3c33d093b7e11cbc9cfb7af2e127c5bf85a12ddf8b5f0425622ca
|
Provenance
The following attestation bundles were made for libbee-0.0.2.tar.gz:
Publisher:
publish.yml on postphotos/libbee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libbee-0.0.2.tar.gz -
Subject digest:
5bcaf4735400a4dca91102253fc1202bd193443d6cb0a572fbbccde72f6c2cb8 - Sigstore transparency entry: 1708388239
- Sigstore integration time:
-
Permalink:
postphotos/libbee@5c2ad50685a0220976e189f16c9bda738412032c -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/postphotos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5c2ad50685a0220976e189f16c9bda738412032c -
Trigger Event:
release
-
Statement type:
File details
Details for the file libbee-0.0.2-py3-none-any.whl.
File metadata
- Download URL: libbee-0.0.2-py3-none-any.whl
- Upload date:
- Size: 94.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56dc84ed92d663c4b69e247cb46c65580e3e8caeabe6fa9d0f06aaf94aade5d7
|
|
| MD5 |
3d2cbbe203d0f39d72cc094971e5dcbd
|
|
| BLAKE2b-256 |
c43dd2ccdf6d02c42436b69207a119d1f9b476ab2f74ae6eae7b0f8f92268f4c
|
Provenance
The following attestation bundles were made for libbee-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on postphotos/libbee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libbee-0.0.2-py3-none-any.whl -
Subject digest:
56dc84ed92d663c4b69e247cb46c65580e3e8caeabe6fa9d0f06aaf94aade5d7 - Sigstore transparency entry: 1708388295
- Sigstore integration time:
-
Permalink:
postphotos/libbee@5c2ad50685a0220976e189f16c9bda738412032c -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/postphotos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5c2ad50685a0220976e189f16c9bda738412032c -
Trigger Event:
release
-
Statement type: