Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day Ahead Prices is missing 1 row due to DST #388

Open
timgitty212 opened this issue Feb 17, 2025 · 4 comments
Open

Day Ahead Prices is missing 1 row due to DST #388

timgitty212 opened this issue Feb 17, 2025 · 4 comments

Comments

@timgitty212
Copy link

def ENTSO_fetch(start, end, country_code):
client = EntsoePandasClient(api_key)

df_temp = client.query_day_ahead_prices(country_code, start=start, end=end)
return df_temp

start_market_date = pd.to_datetime('2023-12-31 23:00:00').tz_localize('UTC')
end_market_date = pd.to_datetime('2024-12-31 22:00:00').tz_localize('UTC')

df_market_price = ENTSO_fetch(start_market_date, end_market_date, country_code)

2024-01-01 00:00:00+01:00 53.79
2024-01-01 01:00:00+01:00 48.98
2024-01-01 02:00:00+01:00 27.45
2024-01-01 03:00:00+01:00 24.48
2024-01-01 04:00:00+01:00 24.01
...
2024-12-31 19:00:00+01:00 31.10
2024-12-31 20:00:00+01:00 29.37
2024-12-31 21:00:00+01:00 24.08
2024-12-31 22:00:00+01:00 20.62
2024-12-31 23:00:00+01:00 21.94
Length: 8783, dtype: float64

@timgitty212
Copy link
Author

Hi does anybody know how to resolve this issue, my entsoepy is the latest with 0.6.18. Even after localizing to their timezone im still missing 1 row in the middle

@fleimgruber
Copy link
Contributor

What do you mean exactly by "missing 1 row in the middle"?

@timgitty212
Copy link
Author

start_market_date = pd.to_datetime('2023-12-31 23:00:00').tz_localize('UTC')
end_market_date = pd.to_datetime('2024-12-31 22:00:00').tz_localize('UTC')

all_dates = pd.date_range(start=df_market_price.index.min(), end=df_market_price.index.max(), freq='h') # Adjust freq as needed

Identify missing dates by comparing with the existing index

missing_rows = all_dates.difference(df_market_price.index)

Display the missing rows

print("Missing rows:", missing_rows)

Missing rows: DatetimeIndex(['2024-12-31 00:00:00+01:00'], dtype='datetime64[ns, Europe/Oslo]', freq='h')

This is the code i ran and the missing data is the one on 31st december

@fleimgruber
Copy link
Contributor

fleimgruber commented Feb 24, 2025

Please put your code in proper python code blocks, see also: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting.

That way comments starting with # do not get interpreted as Markdown sections.

Also, please provide a coherent minimal reproducible example of code that shows your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants