Skip to content

'year_limited' is skipping (sometimes?) the first row of the frames leanding to missing row in final results #363

@sdementen

Description

@sdementen

To reproduce the bug

import pandas
from entsoe import EntsoePandasClient

client = EntsoePandasClient(api_key="397870bf-afdc-4422-ba9e-2d8ef803fa2a")  # API key from Sebastien de Menten (GFJ138), use with care
client.session.verify = False
df = client.query_day_ahead_prices("FR", start=pandas.Timestamp("2022", tz="CET"), end=pandas.Timestamp("2023/02", tz="CET"))
print(df["2022-12-30T22":"2022-12-31T02"])

outputs

2022-12-30 22:00:00+01:00    4.11
2022-12-30 23:00:00+01:00    4.11
2022-12-31 01:00:00+01:00    0.13
2022-12-31 02:00:00+01:00    0.06

where we are missing 2022-12-31 00:00:00+01:00

This is due to the filter https://github.com/EnergieID/entsoe-py/blob/master/entsoe/decorators.py#L139 which may skip the first row of the second and subsequent queries.
This could be replaced by the following that explicitly filter index that would overlap with the previous frame

                        interval_mask = (
                            (frame.index <= _end)
                            & (frame.index > frames[-1].index[-1])
                        )

entsoe.version == "0.6.16"

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