Skip to content

KeyError '60min' when fetching data #295

Closed
@hjaarnio

Description

@hjaarnio

parse_prices tries to access series dict with soup_series.index.freqstr

series = {
        '15T': [],
        '30T': [],
        '60T': []
    }
    for soup in _extract_timeseries(xml_text):
        soup_series = _parse_timeseries_generic(soup, 'price.amount')
        series[soup_series.index.freqstr].append(soup_series)

The string gets set to '60min', and not '60T', which results in a KeyError. The index is set in _parse_datetimeindex:

delta = _resolution_to_timedelta(res_text=soup.find('resolution').text)
index = pd.date_range(start=start, end=end, freq=delta, inclusive='left')

Here's the stacktrace for completeness:

    prices = client.query_day_ahead_prices(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/entsoe/decorators.py", line 122, in year_wrapper
    frame = func(*args, start=_start, end=_end, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/entsoe/entsoe.py", line 1186, in query_day_ahead_prices
    series = parse_prices(text)[resolution]
             ^^^^^^^^^^^^^^^^^^
  File "site-packages/entsoe/parsers.py", line 38, in parse_prices
    series[soup_series.index.freqstr].append(soup_series)
    ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '60min'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions