Skip to main content

bls-datasets

Making datasets easily accessible to python scripts.

Integrated datasets include:

For looking up BLS data via series-id lookups, please checkout OliverSherouse's library: BLS

Usage

>>> from bls_datasets import oes, qcew

# OES example:

>>> df_oes = oes.get_data(year=2017)
>>> df_oes.columns
Index(['OCC_CODE', 'OCC_TITLE', 'OCC_GROUP', 'TOT_EMP', 'EMP_PRSE', 'H_MEAN',
       'A_MEAN', 'MEAN_PRSE', 'H_PCT10', 'H_PCT25', 'H_MEDIAN', 'H_PCT75',
       'H_PCT90', 'A_PCT10', 'A_PCT25', 'A_MEDIAN', 'A_PCT75', 'A_PCT90',
       'ANNUAL', 'HOURLY'],
      dtype='object')

# Which occupation had the highest total employment in 2017?

>>> detailed = df_oes[df_oes.OCC_GROUP == 'detailed']
>>> detailed[detailed.TOT_EMP == detailed.TOT_EMP.max()].OCC_TITLE
772    Retail Salespersons

# QCEW example:
>>> df_qcew = qcew.get_data('industry', rtype='dataframe', year='2017',
...             qtr='1', industry='10')
>>> df_qcew.columns
Index(['area_fips', 'own_code', 'industry_code', 'agglvl_code', 'size_code',
       'year', 'qtr', 'disclosure_code', 'qtrly_estabs', 'month1_emplvl',
       'month2_emplvl', 'month3_emplvl', 'total_qtrly_wages',
       'taxable_qtrly_wages', 'qtrly_contributions', 'avg_wkly_wage',
       'lq_disclosure_code', 'lq_qtrly_estabs', 'lq_month1_emplvl',
       'lq_month2_emplvl', 'lq_month3_emplvl', 'lq_total_qtrly_wages',
       'lq_taxable_qtrly_wages', 'lq_qtrly_contributions', 'lq_avg_wkly_wage',
       'oty_disclosure_code', 'oty_qtrly_estabs_chg',
       'oty_qtrly_estabs_pct_chg', 'oty_month1_emplvl_chg',
       'oty_month1_emplvl_pct_chg', 'oty_month2_emplvl_chg',
       'oty_month2_emplvl_pct_chg', 'oty_month3_emplvl_chg',
       'oty_month3_emplvl_pct_chg', 'oty_total_qtrly_wages_chg',
       'oty_total_qtrly_wages_pct_chg', 'oty_taxable_qtrly_wages_chg',
       'oty_taxable_qtrly_wages_pct_chg', 'oty_qtrly_contributions_chg',
       'oty_qtrly_contributions_pct_chg', 'oty_avg_wkly_wage_chg',
       'oty_avg_wkly_wage_pct_chg'],
      dtype='object')

# What were the average weekly earnings in Fresno County for 2017 Q1?

# FIPS code, area title
# 06019, Fresno County, California

>>> fresno = df_qcew[(df_qcew.own_code == 0) & (df_qcew.area_fips == '06019')]
>>> fresno.avg_wkly_wage.values[0]
803


Installation

pip install bls-datasets

Documentation

Documentation coming soon. Please reference the docstrings in the source code for now.

Notes on datasets

OES

OES consists of occupational statistics, primarily: employment, age, and salary. To learn more about this survey, you can visit this link.

Note that due to idiosyncrasies in earlier OES datasets, this package only allows data access starting in 2014. Earlier files are available, although, they are given different naming patterns, are often broken into multiple excel spreadsheets due to size constraints of older excel version, and they do not always consist of the same datacuts. I will not integrate any earlier years, unless I see it necessary, or receive enough user requests.

QCEW

QCEW consists of employer reported occupational statistics. Data can be cut/sliced by area, industry or company size. To learn more about this survey, you can visit this link

Common gotchas with QCEW data:

  • Datatypes are not always what you expect them to be. Reference the following tables when performing dataframe operations
  • Due to employer confidentiality, some of the figures may be unavailable. This is especially true when making more granular data cuts. Do check the disclosure_code columns for this.

Release files for bls-datasets 0.0.9

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

Source distribution (sdist)

Source distribution for bls-datasets 0.0.9
File Size Uploaded
bls_datasets-0.0.9.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bls-datasets 0.0.9
File Interpreter ABI Platform
bls_datasets-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / bls_datasets-0.0.9.tar.gz

Download URL bls_datasets-0.0.9.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2ed8bdc09180d61cea49322ac153fd708d6c2a9bcffe2ff2e85c31a72f3e4071
BLAKE2b-256 checksum
How to use checksums
47d8f22315571eecc5a9c9ea9173da62b1bbd513b6f4451fac651fe4d478afcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

Release files / bls_datasets-0.0.9-py3-none-any.whl

Download URL bls_datasets-0.0.9-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1333e7d0b6b1ed296fa3af39bb7abcfa209feacb1ecb2bcbf9edba58f2d1a7a4
BLAKE2b-256 checksum
How to use checksums
56c361e48cb5373a904a791595ceebc8ea757f0d0cf57d3a7e262912ff244088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release 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