Skip to content

Commit 29f9e1a

Browse files
authored
Merge pull request #73 from ssenart/develop
[#72] Remove the warning message "UserWarning: Boolean Series key will be reindexed to match DataFrame index. df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df["count"] < 7]])"
2 parents 6b0babf + 53e34fc commit 29f9e1a

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.2.4](https://github.com/ssenart/PyGazpar/compare/1.2.4...1.2.3) - 2024-10-09
8+
9+
### Fixed
10+
- [#72](https://github.com/ssenart/PyGazpar/issues/72): Remove the warning message "UserWarning: Boolean Series key will be reindexed to match DataFrame index. df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df["count"] < 7]])".
11+
712
## [1.2.3](https://github.com/ssenart/PyGazpar/compare/1.2.3...1.2.1) - 2024-10-05
813

914
### Added

pygazpar/datasource.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def _login(self, username: str, password: str) -> str:
9494

9595
params = json.loads(AUTH_TOKEN_PARAMS.format(session_token))
9696

97-
response = session.get(AUTH_TOKEN_URL, params=params, allow_redirects=True, cookies=jar)
97+
response = session.get(AUTH_TOKEN_URL, params=params, allow_redirects=True, cookies=jar) # type: ignore
9898

9999
if response.status_code != 200:
100100
raise Exception(f"An error occurred while getting the auth token. Status code: {response.status_code} - {response.text}")
101101

102102
auth_token = session.cookies.get("auth_token", domain="monespace.grdf.fr")
103103

104-
return auth_token
104+
return auth_token # type: ignore
105105

106106
@abstractmethod
107107
def _loadFromSession(self, auth_token: str, pceIdentifier: str, startDate: date, endDate: date, frequencies: Optional[List[Frequency]] = None) -> MeterReadingsByFrequency:
@@ -211,7 +211,7 @@ def __downloadFile(self, session: Session, url: str, path: str):
211211

212212
response = session.get(url)
213213

214-
if "text/html" in response.headers.get("Content-Type"):
214+
if "text/html" in response.headers.get("Content-Type"): # type: ignore
215215
raise Exception("An error occurred while loading data. Please check your credentials.")
216216

217217
if response.status_code != 200:
@@ -297,7 +297,7 @@ def _loadFromSession(self, auth_token: str, pceIdentifier: str, startDate: date,
297297
try:
298298
response = session.get(downloadUrl)
299299

300-
if "text/html" in response.headers.get("Content-Type"):
300+
if "text/html" in response.headers.get("Content-Type"): # type: ignore
301301
raise Exception("An error occurred while loading data. Please check your credentials.")
302302

303303
if response.status_code != 200:
@@ -466,7 +466,7 @@ def computeWeekly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
466466
df = df.sort_values(by=['first_day_of_week'])
467467

468468
# Select rows where we have a full week (7 days) except for the current week.
469-
df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df["count"] < 7]])
469+
df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df.tail(1)["count"] < 7]])
470470

471471
# Select target columns.
472472
df = df[["time_period", "start_index_m3", "end_index_m3", "volume_m3", "energy_kwh", "timestamp"]]
@@ -494,7 +494,7 @@ def computeMonthly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
494494
df = df.sort_values(by=['first_day_of_month'])
495495

496496
# Select rows where we have a full month (more than 27 days) except for the current month.
497-
df = pd.concat([df[(df["count"] >= 28)], df.tail(1)[df["count"] < 28]])
497+
df = pd.concat([df[(df["count"] >= 28)], df.tail(1)[df.tail(1)["count"] < 28]])
498498

499499
# Rename columns for their target names.
500500
df = df.rename(columns={"month_year": "time_period"})
@@ -525,7 +525,7 @@ def computeYearly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
525525
df = df.sort_values(by=['year'])
526526

527527
# Select rows where we have almost a full year (more than 360) except for the current year.
528-
df = pd.concat([df[(df["count"] >= 360)], df.tail(1)[df["count"] < 360]])
528+
df = pd.concat([df[(df["count"] >= 360)], df.tail(1)[df.tail(1)["count"] < 360]])
529529

530530
# Rename columns for their target names.
531531
df = df.rename(columns={"year": "time_period"})

pygazpar/excelparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def parse(dataFilename: str, dataReadingFrequency: Frequency) -> List[Dict[str,
3333

3434
worksheet = workbook.active
3535

36-
res = parseByFrequency[dataReadingFrequency](worksheet)
36+
res = parseByFrequency[dataReadingFrequency](worksheet) # type: ignore
3737

3838
workbook.close()
3939

0 commit comments

Comments
 (0)