[Python] DataReader KeyError: 'structure' for Oecd data

Discussão em 'Python' iniciado por Stack, Outubro 6, 2024.

  1. Stack

    Stack Membro Participativo

    I'm running the following code to retrive data from OECD:

    import datetime
    import pandas as pd
    import pandas_datareader.data as web

    start_date = datetime.datetime(2013, 12, 31)
    end_date = datetime.datetime(2023, 12, 31)

    #SPECIFIC DATABASE WITHIN OECD API
    database = 'MEI_FIN'

    df1 = web.DataReader(database, 'oecd', start_date, end_date)
    df1


    I'm reciving the following error:

    File D:\conda3\Lib\site-packages\pandas_datareader\io\jsdmx.py:44, in read_jsdmx(path_or_buf)
    41 else:
    42 data = json.loads(jdata, object_pairs_hook=OrderedDict)
    ---> 44 structure = data["structure"]
    45 index = _parse_dimensions(structure["dimensions"]["observation"])
    46 columns = _parse_dimensions(structure["dimensions"]["series"])

    KeyError: 'structure'


    In general, I'm having huge troubles trying to retrieve data from the OECD via Python; almost everything that I tried is not working. I would gladly receive some tips on how to approach this issue.

    Continue reading...

Compartilhe esta Página