Download data from statistical agencies to pandas dataframes.
pip install stats_to_pandas
- pandas
- requests
- pyjstat
- Jupyter notebook, IPython, ipywidgets
import stats_to_pandas as stp
stp.search('cows')
(Works when the user is in a jupyter notebook and has widgets installed)
box = stp.select(table_id = '10714')
df = stp.read_box(box)
(Avoid having to select variables, step 2 above, but may result in large tables)
df = stp.read_all(table_id = '10714')
query = stp.full_json(table_id = '10714', out = 'str')
query = stp.full_json(table_id = '10714', out = 'dict')
query = stp.get_json(box)
irl_url = 'http://www.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/CNA31'
df = stp.read_url(full_url = irl_url)