Error when running query_scheduled_exchanges for AT-HU Total Commercial Schedules
See original GitHub issueHi,
I’m using query_scheduled_exchanges to download the Total Commercial Schedules between pairs of BiddingZones. For most pairs it works OK, but for the Austria-Hungary exchange (AT_HU, and the opposite direction), I’m getting an error:
ValueError: Length mismatch: Expected axis has 24 elements, new values have 93 elements
When I accessed data for this pair through the https://transparency.entsoe.eu/ web interface, I noticed the data is given in 15minutes intervals, so maybe this error is connected with this representation. However, for some other pairs with 15 minutes data, like DE-LU_BE, query_scheduled_exchanges works fine.
I run the entsoe-py on WinPython (WPy64-4741) with Pandas 1.1.5.
Any help to resolve that issue will be much appreciated.
Code to reproduce the error:
from entsoe import EntsoePandasClient
import pandas as pd
client = EntsoePandasClient(api_key="xxx")
start = pd.Timestamp('20201101', tz='UTC')
end = pd.Timestamp('20201102', tz='UTC')
totATHU = client.query_scheduled_exchanges('AT', 'HU', start=start, end=end)
Error:
Traceback (most recent call last):
File "E:/dev/energy/code/mCEP_TP/tp_data/issue.py", line 9, in <module>
trATHU = client.query_scheduled_exchanges('AT', 'HU', start=start, end=end)
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\entsoe\entsoe.py", line 828, in year_wrapper
frame = func(*args, start=_start, end=_end, **kwargs)
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\entsoe\entsoe.py", line 1133, in query_scheduled_exchanges
ts = parse_crossborder_flows(text)
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\entsoe\parsers.py", line 183, in parse_crossborder_flows
series = series.append(_parse_crossborder_flows_timeseries(soup))
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\entsoe\parsers.py", line 521, in _parse_crossborder_flows_timeseries
series.index = _parse_datetimeindex(soup)
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\pandas\core\generic.py", line 5154, in __setattr__
return object.__setattr__(self, name, value)
File "pandas\_libs\properties.pyx", line 66, in pandas._libs.properties.AxisProperty.__set__
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\pandas\core\series.py", line 424, in _set_axis
self._mgr.set_axis(axis, labels)
File "E:\dev\WPy64-3741\python-3.7.4.amd64\lib\site-packages\pandas\core\internals\managers.py", line 227, in set_axis
f"Length mismatch: Expected axis has {old_len} elements, new "
ValueError: Length mismatch: Expected axis has 24 elements, new values have 93 elements
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hi, It seems to be a similar problem as the one mentioned in #97, the issue occurs when duplicates are found in the xml returned by ENTSOE. A simple workaround is proposed in commit #101.
Ah I see, thanks for the quick reply 😃 I’ll let you know if the fix works once the PR is merged!