Skip to content

Commit 0c57d49

Browse files
Add Elec2 API example
1 parent 0f05005 commit 0c57d49

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

frouros/datasets/real.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,42 @@
1111
class Elec2(BaseDatasetDownload):
1212
"""Elec2 dataset [harries1999splice]_.
1313
14+
:param file_path: file path for the downloaded file, defaults to None. If None, the file will be downloaded to a temporary file.
15+
:type file_path: Optional[str]
16+
17+
:Note:
18+
Dataset can be downloaded from the following sources (in order of preference):
19+
20+
- https://nextcloud.ifca.es/index.php/s/2coqgBEpa82boLS/download
21+
- https://www.openml.org/data/download/2419/electricity-normalized.arff
22+
1423
:References:
1524
1625
.. [harries1999splice] Harries, Michael.
1726
"Splice-2 comparative evaluation: Electricity pricing." (1999).
18-
"""
1927
20-
def __init__(self, file_path: Optional[str] = None) -> None:
21-
"""Init method.
28+
:Example:
2229
23-
:param file_path: file path for the downloaded file
24-
:type file_path: Optional[str]
25-
"""
30+
>>> from frouros.datasets.real import Elec2
31+
>>> elec2 = Elec2()
32+
>>> elec2.download()
33+
INFO:frouros:Trying to download data from https://nextcloud.ifca.es/index.php/s/2coqgBEpa82boLS/download to /tmp/tmpro3ienx0
34+
>>> dataset = elec2.load()
35+
>>> dataset
36+
array([(0. , b'2', 0. , 0.056443, 0.439155, 0.003467, 0.422915, 0.414912, b'UP'),
37+
(0. , b'2', 0.021277, 0.051699, 0.415055, 0.003467, 0.422915, 0.414912, b'UP'),
38+
(0. , b'2', 0.042553, 0.051489, 0.385004, 0.003467, 0.422915, 0.414912, b'UP'),
39+
...,
40+
(0.9158, b'7', 0.957447, 0.043593, 0.34097 , 0.002983, 0.247799, 0.362281, b'DOWN'),
41+
(0.9158, b'7', 0.978723, 0.066651, 0.329366, 0.00463 , 0.345417, 0.206579, b'UP'),
42+
(0.9158, b'7', 1. , 0.050679, 0.288753, 0.003542, 0.355256, 0.23114 , b'DOWN')],
43+
dtype=[('date', '<f8'), ('day', 'S1'), ('period', '<f8'), ('nswprice', '<f8'), ('nswdemand', '<f8'), ('vicprice', '<f8'), ('vicdemand', '<f8'), ('transfer', '<f8'), ('class', 'S4')])
44+
""" # noqa: E501 # pylint: disable=line-too-long
45+
46+
def __init__( # noqa: D107
47+
self,
48+
file_path: Optional[str] = None,
49+
) -> None:
2650
super().__init__(
2751
url=[
2852
"https://nextcloud.ifca.es/index.php/s/2coqgBEpa82boLS/download",

0 commit comments

Comments
 (0)