Code Monkey home page Code Monkey logo

bls's Introduction

bls

A Python library for the Bureau of Labor Statistics API.

Branch Status
master master branch status
dev dev branch status

Use the function get_series() to retrieve data. get_series() has four arguments: a series id or sequence of series ids, a start year, an end year, and an optional API key.

It is highly recommended that you register for an API key with BLS. You can supply the key to the library by passing it to get_series() or by setting an environment variable called BLS_API_KEY.

The timespan returned by the get_series() function depends on whether you specify startyear, endyear, api or some combination thereof, as shown in the table below:

startyear endyear api result
no no no BLS default (last 3 years)
yes no no Ten years starting from startyear or until present
no yes no Ten years ending with endyear
yes yes no startyear through endyear if ten years or fewer else error
no no yes BLS default (last 3 years)
yes no yes startyear through present
no yes yes Twenty years ending with endyear
yes yes yes startyear through endyear

bls is under development. Look for new features in the near future, and report bugs at https://github.com/OliverSherouse/bls/issues.

bls's People

Contributors

oliversherouse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bls's Issues

Downloading Industry Level QCEW Employment Data

Is it possible to download industry level QCEW data from the BLS API? I am able to download QCEW employment data for total industries and total private sector employment but when I try to download industry0specific data I receive an error that no data is available for that series.
Thanks!

QCEW_TotEmp_AllIND = bls.get_series('ENU3605310010') #works fine
QCEW_TotEmp_Priv_21 = bls.get_series('ENU3605310555') #No Data Available for Series

Error Msg:
No Data Available for Series ENU3605310555 Year: 2002
No Data Available for Series ENU3605310555 Year: 2003
No Data Available for Series ENU3605310555 Year: 2004
No Data Available for Series ENU3605310555 Year: 2005
No Data Available for Series ENU3605310555 Year: 2006
No Data Available for Series ENU3605310555 Year: 2007
No Data Available for Series ENU3605310555 Year: 2008
No Data Available for Series ENU3605310555 Year: 2009
No Data Available for Series ENU3605310555 Year: 2010
No Data Available for Series ENU3605310555 Year: 2011
No Data Available for Series ENU3605310555 Year: 2012
No Data Available for Series ENU3605310555 Year: 2013
No Data Available for Series ENU3605310555 Year: 2014
No Data Available for Series ENU3605310555 Year: 2015
No Data Available for Series ENU3605310555 Year: 2016
No Data Available for Series ENU3605310555 Year: 2017
No Data Available for Series ENU3605310555 Year: 2018
No Data Available for Series ENU3605310555 Year: 2019
No Data Available for Series ENU3605310555 Year: 2020
No Data Available for Series ENU3605310555 Year: 2021

get_series not working

Hi Oliver,

I was using your package to retrieve data using bls.get_series but today I was trying to run it and it is not retrieving data. There is no error, it is just empty. Even if I run a basic command bls.get_series("CEU0800000003") it only outputs an empty dataframe. (I am using pandas to organize the data). Could you help me trouble shoot this problem?

Passing API Key

I have had a great amount of difficulty passing an API key into my scripts using this package. I have setup the BLS API key as either an environment variable or tried passing into the script but have not had any success. Would you please provide sample code of passing a sample API key into the script in the form of an environment variable and using the getseries method you previously suggested?
Thank you,

Requesting current-year releases in a time series

I can't tell if this is fundamentally an API problem or something we can solve, but say I want to retrieve the last 12 months of the LNS14000000 national unemployment rate series. My first thought is to call

>>> get_series('LNS14000000')

As of writing this, it is March 2017 and there have been two releases for this series in 2017. However, the last entry of the result is

2016-12-01    4.7

This suggests to me that the default end year 2017 is cutting off at the start of 2017. If I supply 2018, the wrapper catches this and sends 2017 anyways. (I've tried just using the API, and supplying 2018 produces an error).

Annual averages

Thanks again for making this! It's really helped me.

The BLS changed their API and now the annual averages aren't included automatically. Is there a way to toggle this in the code?

Handle Quarterly Data Properly

Pandas chokes if the date string is, eg, "2017Q04". This makes sense, because there is no reason to zero pad a quarter, ever. Come on, BLS.

bls.py not found

Hi Oliver,
when run the setup.py install, I receive file bls.py (for module bls) not found error.

thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.