Skip to content

Commit

Permalink
bugfix for curvetype when there is a repeating value at the end of a …
Browse files Browse the repository at this point in the history
…block
  • Loading branch information
fboerman committed Dec 21, 2023
1 parent 5cfe3b6 commit cfe4722
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion entsoe/entsoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning)

__title__ = "entsoe-py"
__version__ = "0.6.0"
__version__ = "0.6.1"
__author__ = "EnergieID.be, Frank Boerman"
__license__ = "MIT"

Expand Down
5 changes: 3 additions & 2 deletions entsoe/series_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ def _parse_timeseries_generic(soup, label='quantity', to_float=True):

series = pd.Series(data)
series.sort_index()
index = _parse_datetimeindex(soup)
if soup.find('curvetype').text == 'A03':
# with A03 its possible that positions are missing, this is when values are repeated
# see docs: https://eepublicdownloads.entsoe.eu/clean-documents/EDI/Library/cim_based/Introduction_of_different_Timeseries_possibilities__curvetypes__with_ENTSO-E_electronic_document_v1.4.pdf
# so lets do reindex on a continious range which creates gaps if positions are missing
# then forward fill, so repeat last valid value, to fill the gaps
series = series.reindex(list(range(series.index.min(), series.index.max() + 1))).ffill()
series = series.reindex(list(range(1, len(index)+1))).ffill()

series.index = _parse_datetimeindex(soup)
series.index = index
if to_float:
series = series.astype(float)

Expand Down

0 comments on commit cfe4722

Please sign in to comment.