mirror of
https://github.com/Dasemu/skipredictor.git
synced 2026-11-26 15:26:15 +00:00
fix(pipeline): preserve historical features
This commit is contained in:
1 parent
4933c61c69
commit
e14a9f2d3b
3 files changed
+137
-35
No files matched your search
@@ -7,7 +7,6 @@ handles missing data, and writes a processed dataset to disk.
|
||||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@@ -19,7 +18,6 @@ logger = logging.getLogger(__name__)
|
||||
_REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
_RAW_DIR = _REPO_ROOT / "data" / "raw"
|
||||
_PROCESSED_DIR = _REPO_ROOT / "data" / "processed"
|
||||
_DATASET_PATH = _PROCESSED_DIR / "dataset.csv"
|
||||
|
||||
# Numeric weather columns that can be safely interpolated when values are
|
||||
# missing in the middle of a time series. Columns not listed here are filled
|
||||
@@ -231,13 +229,14 @@ class DatasetBuilder:
|
||||
|
||||
def _load_existing_dataset(self) -> pd.DataFrame:
|
||||
"""Return the persisted processed dataset, or an empty DataFrame."""
|
||||
if _DATASET_PATH.exists():
|
||||
df = pd.read_csv(_DATASET_PATH)
|
||||
dataset_path = self.processed_dir / "dataset.csv"
|
||||
if dataset_path.exists():
|
||||
df = pd.read_csv(dataset_path)
|
||||
df["date"] = pd.to_datetime(df["date"], format="mixed")
|
||||
logger.debug("Loaded existing dataset with %d rows.", len(df))
|
||||
return df
|
||||
|
||||
logger.debug("No existing dataset found at %s.", _DATASET_PATH)
|
||||
logger.debug("No existing dataset found at %s.", dataset_path)
|
||||
return pd.DataFrame()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user