Skip to main content

Energy Price Forecasting Toolbox 2

Project description

epftoolbox2

A modern Python library for electricity price forecasting with modular data pipelines and model evaluation. Built as a complete rewrite of the original epftoolbox, this library provides a flexible, extensible framework for downloading energy market data, building forecasting models, and evaluating their performance.

📖 Documentation

Installation

pip install epftoolbox2

or with uv

uv add epftoolbox2

Verify Installation

After installation, you can verify your setup and check system information:

import epftoolbox2

epftoolbox2.verify()

Key Features

  • Data Sources: ENTSOE (load, generation, prices), Open-Meteo (weather forecasts), Calendar (holidays, weekday)
  • Transformers: Resample, Timezone conversion, Lag features
  • Validators: Null checks, Continuity checks, EDA statistics
  • Models: OLS, LassoCV
  • Evaluators: MAE
  • Exporters: Excel with conditional formatting, Terminal output
  • Caching: Built-in data caching to avoid redundant API calls
  • Pipelines: Data and model pipelines that can be saved and loaded with .yaml files
  • Multiprocessing: Process-based parallelism with inner thread pools
  • Extensibility: Extensible base classes for data sources, transformers, validators, models, evaluators, and exporters

Quick Start

Standalone source use

from epftoolbox2.data.sources import EntsoeSource

source = EntsoeSource("PL", api_key="YOUR_KEY", type=["load", "price"])
df = source.run("2024-01-01", "2024-06-01", cache=True)

Standalone transformer use

from epftoolbox2.data.transformers import ResampleTransformer

transformer = ResampleTransformer(freq="1h")
df = transformer.run(df)

Standalone validator use

from epftoolbox2.data.validators import NullCheckValidator

validator = NullCheckValidator(columns=["load_actual", "price"])
df = validator.run(df)

Standalone model use

from epftoolbox2.models import OLSModel

seasonal_indicators = [
    "is_monday_d+{horizon}",
    "is_tuesday_d+{horizon}",
    "is_wednesday_d+{horizon}",
    "is_thursday_d+{horizon}",
    "is_friday_d+{horizon}",
    "is_saturday_d+{horizon}",
    "is_sunday_d+{horizon}",
    "is_holiday_d+{horizon}",
    "daylight_hours_d+{horizon}",
]

model = OLSModel(predictors=["load_actual", *seasonal_indicators], name="OLS")
report = model.run(df, test_start="2024-04-01", test_end="2024-06-01", target="price")

Standalone evaluator use

from epftoolbox2.evaluators import MAEEvaluator

evaluator = MAEEvaluator()
report = evaluator.run(df, test_start="2024-04-01", test_end="2024-06-01", target="price")

Standalone exporter use

from epftoolbox2.exporters import ExcelExporter

exporter = ExcelExporter("results.xlsx")
report = exporter.run(df, test_start="2024-04-01", test_end="2024-06-01", target="price")

Data Pipeline

Download and process electricity market data from ENTSOE, weather forecasts from Open-Meteo, and calendar features.

from epftoolbox2.pipelines import DataPipeline
from epftoolbox2.data.sources import EntsoeSource, OpenMeteoSource, CalendarSource
from epftoolbox2.data.transformers import ResampleTransformer
from epftoolbox2.data.validators import NullCheckValidator

pipeline = (
    DataPipeline()
    .add_source(EntsoeSource("PL", api_key="YOUR_KEY", type=["load", "price"]))
    .add_source(OpenMeteoSource(latitude=52.23, longitude=21.01))
    .add_source(CalendarSource("PL", holidays="binary", weekday="number"))
    .add_transformer(ResampleTransformer(freq="1h"))
    .add_validator(NullCheckValidator(columns=["load_actual", "price"]))
)

df = pipeline.run("2024-01-01", "2024-06-01", cache=True)

Model Pipeline

Train and evaluate forecasting models with built-in metrics and export capabilities.

from epftoolbox2.pipelines import ModelPipeline
from epftoolbox2.models import OLSModel, LassoCVModel
from epftoolbox2.evaluators import MAEEvaluator
from epftoolbox2.exporters import ExcelExporter

pipeline = (
    ModelPipeline()
    .add_model(OLSModel(predictors=["load_actual", *seasonal_indicators], name="OLS"))
    .add_model(LassoCVModel(predictors=["load_actual", *seasonal_indicators], name="Lasso"))
    .add_evaluator(MAEEvaluator())
    .add_exporter(ExcelExporter("results.xlsx"))
)

report = pipeline.run(df, test_start="2024-04-01", test_end="2024-06-01", target="price")

Examples

See the examples/ folder for complete working examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epftoolbox2-2.2.1.tar.gz (282.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epftoolbox2-2.2.1-py3-none-any.whl (76.3 kB view details)

Uploaded Python 3

File details

Details for the file epftoolbox2-2.2.1.tar.gz.

File metadata

  • Download URL: epftoolbox2-2.2.1.tar.gz
  • Upload date:
  • Size: 282.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for epftoolbox2-2.2.1.tar.gz
Algorithm Hash digest
SHA256 b51b95495b40b409f06d7c5eb58ebb0caa0ae7e3db9b81b29f7f0fbc85d65b81
MD5 f92d65d34bf253f7c685b4226c214a3b
BLAKE2b-256 3990bc0bf03b8a58c71a211a491ad6f28ee57b54aefd21a16e29b9e7c54227df

See more details on using hashes here.

File details

Details for the file epftoolbox2-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: epftoolbox2-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 76.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for epftoolbox2-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 106bd7b8b1d20e2780f10462b45a6de08c5ff65ef3ec7f7a3459d43de10c402f
MD5 e8d6c279cf859086c817a1f72bceb733
BLAKE2b-256 51e27e8e3e28fb5efad1fea9e9c1e371c11a731ecde38739dd95f55ed009c57b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page