From afcd88814f212202ad8c465ff0877f51af2fcd2e Mon Sep 17 00:00:00 2001 From: Frank Boerman Date: Fri, 26 Jan 2024 10:31:50 +0100 Subject: [PATCH] fixed #295 changed pandas freqstr in parse_prices. this requires pandas to be >= 2.2.0 --- .gitignore | 2 ++ entsoe/entsoe.py | 12 ++++++------ entsoe/parsers.py | 6 +++--- requirements.txt | 2 +- setup.py | 3 ++- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index f850f4d..3be5976 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # odd custom folders ne_10m_admin_0_countries +scratch + # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/entsoe/entsoe.py b/entsoe/entsoe.py index ffbdb99..18b2837 100644 --- a/entsoe/entsoe.py +++ b/entsoe/entsoe.py @@ -23,7 +23,7 @@ warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning) __title__ = "entsoe-py" -__version__ = "0.6.2" +__version__ = "0.6.3" __author__ = "EnergieID.be, Frank Boerman" __license__ = "MIT" @@ -1160,12 +1160,12 @@ def query_day_ahead_prices( self, country_code: Union[Area, str], start: pd.Timestamp, end: pd.Timestamp, - resolution: List[Literal['60T', '30T', '15T']] = '60T') -> pd.Series: + resolution: List[Literal['60min', '30min', '15min']] = '60min') -> pd.Series: """ Parameters ---------- - resolution: either 60T for hourly values, - 30T for half-hourly values or 15T for quarterly values, throws error if type is not available + resolution: either 60min for hourly values, + 30min for half-hourly values or 15min for quarterly values, throws error if type is not available country_code : Area|str start : pd.Timestamp end : pd.Timestamp @@ -1174,8 +1174,8 @@ def query_day_ahead_prices( ------- pd.Series """ - if resolution not in ['60T', '30T', '15T']: - raise InvalidParameterError('Please choose either 60T, 30T or 15T') + if resolution not in ['60min', '30min', '15min']: + raise InvalidParameterError('Please choose either 60min, 30min or 15min') area = lookup_area(country_code) # we do here extra days at start and end to fix issue 187 text = super(EntsoePandasClient, self).query_day_ahead_prices( diff --git a/entsoe/parsers.py b/entsoe/parsers.py index e9689fd..cc75f46 100644 --- a/entsoe/parsers.py +++ b/entsoe/parsers.py @@ -29,9 +29,9 @@ def parse_prices(xml_text): pd.Series """ series = { - '15T': [], - '30T': [], - '60T': [] + '15min': [], + '30min': [], + '60min': [] } for soup in _extract_timeseries(xml_text): soup_series = _parse_timeseries_generic(soup, 'price.amount') diff --git a/requirements.txt b/requirements.txt index a4eed23..7f0c691 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ requests pytz beautifulsoup4>=4.11.1 -pandas>=1.4.0 +pandas>=2.2.0 diff --git a/setup.py b/setup.py index 2b981e5..e4f1ae4 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,7 @@ # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11' ], keywords='ENTSO-E data api energy', @@ -67,7 +68,7 @@ # List run-time dependencies here. These will be installed by pip when # your project is installed. - install_requires=['requests', 'pytz', 'beautifulsoup4>=4.11.1', 'pandas>=1.4.0'], + install_requires=['requests', 'pytz', 'beautifulsoup4>=4.11.1', 'pandas>=2.2.0'], include_package_data=True, )