python-esios 0.2.5__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-esios
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: A Python wrapper for the ESIOS API
5
5
  Home-page: https://github.com/datons/python-esios
6
6
  Author: Jesús López
@@ -13,6 +13,16 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: requests
15
15
  Requires-Dist: pandas
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
16
26
 
17
27
  # A Python library to download preprocessed data from the ESIOS API (REE)
18
28
 
@@ -0,0 +1,32 @@
1
+ from pathlib import Path
2
+ import pandas as pd
3
+
4
+
5
+ def process_excel_file(path, sheet_name):
6
+ """
7
+ Process an Excel file and return a melted dataframe.
8
+ """
9
+
10
+ if not isinstance(path, Path):
11
+ path = Path(path)
12
+
13
+ sheet_data = pd.read_excel(path, sheet_name=sheet_name, skiprows=0, nrows=1)
14
+ position = sheet_data.columns.get_loc("Indicadores")
15
+
16
+ df = pd.read_excel(
17
+ path, sheet_name=sheet_name, index_col=list(range(position)), skiprows=2
18
+ ).iloc[:, 2:]
19
+
20
+ date = path.stem.split("_")[1]
21
+
22
+ if df.shape[1] > 30:
23
+ date_ = pd.to_datetime(date).tz_localize("Europe/Madrid")
24
+ date_range = pd.date_range(start=date_, periods=df.shape[1], freq="15min")
25
+ df.columns = date_range
26
+ else:
27
+ hour = df.columns.str.split("-", expand=True).get_level_values(0)
28
+ df.columns = pd.to_datetime(date + " " + hour).tz_localize("Europe/Madrid")
29
+
30
+ df = df.melt(ignore_index=False, var_name="datetime").reset_index()
31
+
32
+ return df
@@ -16,7 +16,8 @@ class Indicators:
16
16
 
17
17
  indicators = data.get('indicators', [])
18
18
  for indicator in indicators:
19
- indicator['description'] = self._html_to_text(indicator['description'])
19
+ if 'description' in indicator:
20
+ indicator['description'] = self._html_to_text(indicator['description'])
20
21
  return pd.DataFrame(indicators)
21
22
 
22
23
  def select(self, id):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-esios
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: A Python wrapper for the ESIOS API
5
5
  Home-page: https://github.com/datons/python-esios
6
6
  Author: Jesús López
@@ -13,6 +13,16 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: requests
15
15
  Requires-Dist: pandas
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: license-file
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
16
26
 
17
27
  # A Python library to download preprocessed data from the ESIOS API (REE)
18
28
 
@@ -2,10 +2,11 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  esios/__init__.py
5
- esios/archives.py
6
5
  esios/client.py
7
6
  esios/indicators.py
8
7
  esios/offer_indicators.py
8
+ esios/archives/__init__.py
9
+ esios/archives/preprocessing.py
9
10
  python_esios.egg-info/PKG-INFO
10
11
  python_esios.egg-info/SOURCES.txt
11
12
  python_esios.egg-info/dependency_links.txt
@@ -2,27 +2,28 @@ from setuptools import setup, find_packages
2
2
 
3
3
 
4
4
  from pathlib import Path
5
+
5
6
  this_directory = Path(__file__).parent
6
- long_description = (this_directory / "README.md").read_text(encoding='utf-8')
7
+ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
7
8
 
8
9
  setup(
9
- name='python-esios',
10
- version='0.2.5',
10
+ name="python-esios",
11
+ version="0.2.7",
11
12
  packages=find_packages(),
12
13
  install_requires=[
13
- 'requests',
14
- 'pandas',
14
+ "requests",
15
+ "pandas",
15
16
  ],
16
17
  author="Jesús López",
17
18
  author_email="jesus.lopez@datons.ai",
18
19
  description="A Python wrapper for the ESIOS API",
19
20
  long_description=long_description,
20
- long_description_content_type='text/markdown',
21
+ long_description_content_type="text/markdown",
21
22
  url="https://github.com/datons/python-esios",
22
23
  classifiers=[
23
24
  "Programming Language :: Python :: 3",
24
25
  "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
25
26
  "Operating System :: OS Independent",
26
27
  ],
27
- python_requires='>=3.6',
28
+ python_requires=">=3.6",
28
29
  )
File without changes
File without changes
File without changes