Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

us-pls

A client to pull and query data from the Public Libraries Survey.

The Public Libraries Survey

From the Institute of Museum and Library Services' website:

The Public Libraries Survey (PLS) examines when, where, and how library services are changing to meet the needs of the public. These data, supplied annually by public libraries across the country, provide information that policymakers and practitioners can use to make informed decisions about the support and strategic management of libraries.

Installation

pip install us-pls

Getting started

Begin by selecting the year of the survey:

>>> from us_pls import PublicLibrariesSurvey
>>> pls_client = PublicLibrariesSurvey(year=2017)

<PublicLibrariesSurvey 2017>

Getting data

The survey offers three datasets:

  1. Public Library System Data File (DatafileType.SystemData). This contains one row per library in the US
  2. Public Library State Summary/State Characteristics Data File (DatafileType.StateSummaryAndCharacteristicData). The contains one row per state in the US, as well as outlying areas.
  3. Public Library Outlet Data File (OutletData). The contains data for public library service outlets (e.g., central, branch, bookmobile, and books-by-mail-only outlets)

To select and query a dataset, do the following:

>>> from us_pls import DatafileType
>>> pls_client.get_stats(_for=DatafileType.<Type of interest>)

<pandas.DataFrame with the data>

Understanding the variables

Unfortunately, the PLS does not have any API serving its data. As a result, this client works by scraping the PLS page (which contains all of its surveys), storing its survey and documentation URLs, and then downloading the surveys and documentation for the year of interest.

Because the documentation files are PDFs, and lack a standardized formatting from year to year, there is no deterministic way to extract variable data from them programmatically.

As a result, the client will also download a given year's survey's documentation. (By default it will store this in the your current directory under data/<survey-year>/Documentation.pdf.) So, if you want to verify what a variable name means, or, if you'd like to read more about that survey's methodology, that documentation file will be your friend.

"But I don't want to read!"

If you really hate reading, or you want a broad overview of what each datafile contains, run the following (we're using the Outlet Data file as an example):

>>> pls_client.read_docs(on=DatafileType.OutletData)

"Public Library Outlet Data File includes..."

Metadata

Release files for us-pls 0.0.2a7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for us-pls 0.0.2a7
File Size Uploaded Provenance Actions
us-pls-0.0.2a7.tar.gz 17.6 kB Without provenance Details for us-pls-0.0.2a7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for us-pls 0.0.2a7
File Interpreter ABI Platform Actions
us_pls-0.0.2a7-py3-none-any.whl Python 3 none any Details for us_pls-0.0.2a7-py3-none-any.whl

Total release size: 43.1 kB

Release files / us-pls-0.0.2a7.tar.gz

Download URL us-pls-0.0.2a7.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c52f500a8938692724edfd5d65883691c99b974883bc41cee6f82cf2b9c21a0f
BLAKE2b-256 checksum
How to use checksums
9d9d21f122933e3461bc562b7f1d5ac0ea97856f30dd8793ff1a0533ba45099b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1036-azure

Release files / us_pls-0.0.2a7-py3-none-any.whl

Download URL us_pls-0.0.2a7-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c11e72538783a9e084aebc4887bdcde63f2d99aee936d524a97d8c13d38731a0
BLAKE2b-256 checksum
How to use checksums
127fade9f3b115d3e0d3dad5f61b268a1223b811da73321068e94e5e61a8c084
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1036-azure

Security for us-pls 0.0.2a7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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