diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f18964..dec9f57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,23 +6,44 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [0.8.0](https://github.com/georgedouzas/sports-betting/releases/tag/0.8.0) - 2023-09-30 +## [0.8.1](https://github.com/georgedouzas/sports-betting/releases/tag/0.8.1) - 2024-03-08 + +[Compare with 0.8.0](https://github.com/georgedouzas/sports-betting/compare/0.8.0...0.8.1) + +### Bug Fixes + +- Decode response and convert data types ([a265162](https://github.com/georgedouzas/sports-betting/commit/a2651620a44993000bcfa1f5d91ae2b0ff219461) by georgedouzas). + +### Docs + +- Fix README typo ([ad67830](https://github.com/georgedouzas/sports-betting/commit/ad6783081d6ee2ab646a255aa82bf875db3efc1d) by georgedouzas). + +### Chore + +- Sort imports ([eebf12f](https://github.com/georgedouzas/sports-betting/commit/eebf12f8911539aba36dc5f16a2763a087bf8fbc) by georgedouzas). +- Silence ruff usage and configuration warnings ([b4a9815](https://github.com/georgedouzas/sports-betting/commit/b4a9815969274c35b48420a3e6647267be2c9617) by georgedouzas). +- Predictions 13/10/2023 ([77a3a72](https://github.com/georgedouzas/sports-betting/commit/77a3a723b464cd45418936076d27fb14e2bfc0b1) by georgedouzas). +- Predictions 03/10/2023 ([6af121b](https://github.com/georgedouzas/sports-betting/commit/6af121be9aef9b4c51bfd7866ddfb9b38e6b5576) by georgedouzas). +- Skip session if fixtures data are empty ([00d3eeb](https://github.com/georgedouzas/sports-betting/commit/00d3eeb0eb491f94f1036096d97f7fab6e303b98) by georgedouzas). + +## [0.8.0](https://github.com/georgedouzas/sports-betting/releases/tag/0.8.0) - 2023-09-29 [Compare with 0.7.0](https://github.com/georgedouzas/sports-betting/compare/0.7.0...0.8.0) ### Features -- Use footballdata only for data source ([2b41ad0](https://github.com/georgedouzas/sports-betting/commit/2b41ad05c336ec769882b1ff39179c42d686ee65) by georgedouzas). +- Use footballdata only for data source ([582d547](https://github.com/georgedouzas/sports-betting/commit/582d54782a299312badc19641c15ba632a7934ea) by georgedouzas). ### Style -- Split line ([893cd70](https://github.com/georgedouzas/sports-betting/commit/893cd70c17c9f57e149c27adb83c0629f80bdda5) by georgedouzas). +- Split line ([6b93930](https://github.com/georgedouzas/sports-betting/commit/6b9393045ad00930bac816fa46266e8763ec4099) by georgedouzas). ### Chore -- Ignore warnings ([36ff455](https://github.com/georgedouzas/sports-betting/commit/36ff455dcf6dce6583a991218b79b88ef4db4e91) by georgedouzas). -- Update Pandas dependency ([cf179d8](https://github.com/georgedouzas/sports-betting/commit/cf179d8c48c4b8c7942f25c700c56a3a8b05630c) by georgedouzas). -- Update copier template ([e5b5a0a](https://github.com/georgedouzas/sports-betting/commit/e5b5a0a606ecfefdc8a7aa3e3779032dc3589914) by georgedouzas). +- Release 0.8.0 ([b611337](https://github.com/georgedouzas/sports-betting/commit/b611337962073f27cb2c403586657e05c3293365) by georgedouzas). +- Ignore warnings ([6b78adc](https://github.com/georgedouzas/sports-betting/commit/6b78adc69618eb96f3a2cefa890a8beafe6cb181) by georgedouzas). +- Update Pandas dependency ([51a9a13](https://github.com/georgedouzas/sports-betting/commit/51a9a139a6e7ccfa09a56039bbd8f683dbef9dff) by georgedouzas). +- Update copier template ([a724b9e](https://github.com/georgedouzas/sports-betting/commit/a724b9e6bfeca4a5f04595e2c8670448c6e0d866) by georgedouzas). ## [0.7.0](https://github.com/georgedouzas/sports-betting/releases/tag/0.7.0) - 2023-09-23 diff --git a/README.md b/README.md index d5cfb19..f0a5c93 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ The dictionary `CONFIG` has the following structure: - The `'data'` key has a nested dictionary as a value with a mandatory key '`dataloader`' and the optional keys `'param_grid'`, `'drop_na_thres'` and `'drop_na'`. You can refer to the [API](api/datasets) for more details about their values. - The `'betting'` key has a nested dictionary as a value with a mandatory key '`bettor`' and the optional keys `'tscv'`, and - `'inti_cash'`. You can refer to the [API](api/datasets) for more details about their values. + `'init_cash'`. You can refer to the [API](api/datasets) for more details about their values. #### Dataloader @@ -293,7 +293,7 @@ sportsbet dataloader odds-types -c config.py Extract training data and save them as CSV files: ```bash -sportsbet dataloader training -c dataloader_config.py -d /path/to/directory +sportsbet dataloader training -c config.py -d /path/to/directory ``` Extract fixtures data and save them as CSV files: diff --git a/noxfile.py b/noxfile.py index ffca43e..47ba591 100644 --- a/noxfile.py +++ b/noxfile.py @@ -81,7 +81,7 @@ def checks(session: nox.Session, file: str) -> None: check_cli(session, ['all', 'quality', 'dependencies', 'types']) session.run('pdm', 'install', '-dG', 'checks', '--no-default', external=True) if session.posargs[0] in ['quality', 'all']: - session.run('ruff', file) + session.run('ruff', 'check', file) if session.posargs[0] in ['types', 'all']: session.run('mypy', file) if session.posargs[0] in ['dependencies', 'all']: diff --git a/pyproject.toml b/pyproject.toml index ba850e7..29c1b8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,27 +120,29 @@ extend-exclude = "(tests/fixtures|docs/generated)" skip-string-normalization = true [tool.ruff] -select = ["C", "E", "F", "W", "B", "I", "D", "N", "UP", "YTT", "ANN", "S", +fix = true +extend-exclude = ["docs/generated"] +force-exclude = true +line-length = 120 +target-version = "py39" + +[tool.ruff.lint] +fixable = ["C", "E", "F", "W", "B", "I", "D", "N", "UP", "YTT", "ANN", "S", "BLE", "A", "COM", "C4", "DTZ", "T10", "EM", "EXE", "ISC", "ICN", "G", "INP", "PIE", "T20", "PT", "Q", "RET501", "RET502", "RET503", "SIM", "PTH", "PD", "PGH", "PL", "TRY", "RUF", "PLE", "PLR", "PLW", "TRY", "RUF"] ignore = ["D202", "N806", "N803", "S101", "INP001", "Q000", "TRY002", "PLR0913", "EXE001", "EXE002", "E741"] -fix = true -fixable = ["C", "E", "F", "W", "B", "I", "D", "N", "UP", "YTT", "ANN", "S", +select = ["C", "E", "F", "W", "B", "I", "D", "N", "UP", "YTT", "ANN", "S", "BLE", "A", "COM", "C4", "DTZ", "T10", "EM", "EXE", "ISC", "ICN", "G", "INP", "PIE", "T20", "PT", "Q", "RET501", "RET502", "RET503", "SIM", "PTH", "PD", "PGH", "PL", "TRY", "RUF", "PLE", "PLR", "PLW", "TRY", "RUF"] -extend-exclude = ["docs/generated"] -force-exclude = true -line-length = 120 -target-version = "py39" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "docs/examples/*" = ["ANN", "D", "B018"] "docs/generated/*" = ["ANN", "D"] "test_*" = ["ANN"] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" [tool.mypy] diff --git a/src/sportsbet/datasets/_base.py b/src/sportsbet/datasets/_base.py index bfdfabb..0d780a8 100644 --- a/src/sportsbet/datasets/_base.py +++ b/src/sportsbet/datasets/_base.py @@ -131,7 +131,12 @@ def _convert_data_types(self: Self, data: pd.DataFrame) -> pd.DataFrame: }, ) if converted_cols: - data_converted_cols = data[converted_cols].fillna(-1 if data_type is np.int64 else np.nan) + data_converted_cols = data[converted_cols] + if data_type is float or data_type is np.int64: + data_converted_cols = data_converted_cols.replace('-', np.nan) + data_converted_cols = data_converted_cols.infer_objects().fillna( + -1 if data_type is np.int64 else np.nan, + ) data[converted_cols] = ( data_converted_cols.to_numpy().astype(data_type) if data_type is not np.datetime64 diff --git a/src/sportsbet/datasets/_soccer/_fd.py b/src/sportsbet/datasets/_soccer/_fd.py index b6cc387..3b6d9e8 100644 --- a/src/sportsbet/datasets/_soccer/_fd.py +++ b/src/sportsbet/datasets/_soccer/_fd.py @@ -10,10 +10,10 @@ from __future__ import annotations +import warnings from datetime import datetime from functools import lru_cache from typing import ClassVar -import warnings import numpy as np import pandas as pd diff --git a/src/sportsbet/datasets/_soccer/_utils.py b/src/sportsbet/datasets/_soccer/_utils.py index 6f7d756..70ed2ad 100644 --- a/src/sportsbet/datasets/_soccer/_utils.py +++ b/src/sportsbet/datasets/_soccer/_utils.py @@ -72,7 +72,7 @@ async def _read_url_content_async(client: aiohttp.ClientSession, url: str) -> str: """Read asynchronously the URL content.""" async with client.get(url) as response: - with io.StringIO(await response.text()) as text_io: + with io.StringIO(await response.text(encoding='ISO-8859-1')) as text_io: return text_io.getvalue()