0

Is there anyone who got ABS data using pandasmsdx library?

Here is the code to get data from European Central Bank (ECB) which is working.

from pandasdmx import Request
ecb = Request('ECB')  
flow_response = ecb.dataflow()
print(flow_response.write().dataflow.head())
exr_flow = ecb.dataflow('EXR')
dsd = exr_flow.dataflow.EXR.structure()
data_response = ecb.data(resource_id='EXR', key={'CURRENCY': ['USD', 'JPY']}, params={'startPeriod': '2016'})

However, when I change Request('ECB') to Request('ABS') , error popups in 2nd line saying,

"{ValueError}This agency only supports requests for data, not dataflow."

Is there a way to get data from ABS?

documentation for pandasdmx: https://pandasdmx.readthedocs.io/en/stable/usage.html#basic-usage

Jaliya
  • 337
  • 5
  • 20

1 Answers1

0

Hope this will help

from pandasdmx import Request

Agency_Code = 'ABS'
Dataset_Id = 'ATSI_BIRTHS_SUMM'
ABS = Request(Agency_Code)
data_response = ABS.data(resource_id='ATSI_BIRTHS_SUMM', params={'startPeriod': '2016'})

#This will result into a stacked DataFrame
df = data_response.write(data_response.data.series, parse_time=False)

#A flat DataFrame
data_response.write().unstack().reset_index()

Australian Bureau of Statistics (ABS) only supports to their SDMX-JSON APIs, they don't send SDMX-ML messages like others. That's the reason it doesn't supports dataflow feature.

Please read for further reference: https://pandasdmx.readthedocs.io/en/stable/agencies.html#pre-configured-data-providers

  • Thanks.. This is working properly. However I found a query builder in ABS ([link](http://stat.data.abs.gov.au/sdmx-json/)). How can I use that query to get data other than defining a Dataset_Id? Is there any document to find Dataset_Ids in ABS? – Jaliya Feb 19 '20 at 06:50