Skip to main content

Client to get and analyze data from the US Public Library Survey

Project description

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..."

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

us-pls-0.0.2a7.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

us_pls-0.0.2a7-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file us-pls-0.0.2a7.tar.gz.

File metadata

  • Download URL: us-pls-0.0.2a7.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1036-azure

File hashes

Hashes for us-pls-0.0.2a7.tar.gz
Algorithm Hash digest
SHA256 c52f500a8938692724edfd5d65883691c99b974883bc41cee6f82cf2b9c21a0f
MD5 82546e30bbaefa341cfed40627bdfe8c
BLAKE2b-256 9d9d21f122933e3461bc562b7f1d5ac0ea97856f30dd8793ff1a0533ba45099b

See more details on using hashes here.

File details

Details for the file us_pls-0.0.2a7-py3-none-any.whl.

File metadata

  • Download URL: us_pls-0.0.2a7-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1036-azure

File hashes

Hashes for us_pls-0.0.2a7-py3-none-any.whl
Algorithm Hash digest
SHA256 c11e72538783a9e084aebc4887bdcde63f2d99aee936d524a97d8c13d38731a0
MD5 75f1e3095e1d7ca8d3ba7c74d3eaaee6
BLAKE2b-256 127fade9f3b115d3e0d3dad5f61b268a1223b811da73321068e94e5e61a8c084

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