Giter Club home page Giter Club logo

ssb_api_helper's Introduction

SSB_API_helper

Writing the "query" statement to make an API call to StatBank of Statistics Norway (SSB) can be quite annoying. The functions here help forming the query string by pre-populating the query with available variables.

Usage

To get table 09189, one need to call

df_gdp = ssb_get_table('09189')

This acquires the entire table and returns it as a pandas dataframe. One can alternately call

available_vars = ssb_get_var_info('09189')

to get a dict of available variables, and then feed in updated available_var to ssb_get_table to get a subset of the available variables.

available_vars = ssb_get_var_info('09189')
# After editing available_vars
dg_gdp = ssb_get_table('09189', vars_cell = available_vars)

One can also download the table in separate chunks and put a wait time between API call by setting n_step and wait_time.

Lastly, though this is a thin wrapper around pandas.pivot function, I frequently rotate the result dataframe with

df_gdp = ssb_rotate_table(df_gdp)

to get wide table with years (ind) as indices.

Todo:

  • Separate example files

ssb_api_helper's People

Contributors

sehyoun avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.