Metadata-Version: 2.4
Name: epftoolbox2
Version: 2.0.0a1
Summary: Energy Price Forecasting Toolbox 2
Project-URL: Homepage, https://github.com/dawidlinek/epftoolbox2
Project-URL: Documentation, https://dawidlinek.github.io/epftoolbox2
Project-URL: Repository, https://github.com/dawidlinek/epftoolbox2
Project-URL: Issues, https://github.com/dawidlinek/epftoolbox2/issues
Author-email: Dawid Linek <dawid@linek.dev>
License: GPL-3.0
License-File: LICENSE
Keywords: deep learning,electricity price,energy,forecasting,machine learning,toolbox
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: astral>=3.2
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: holidays>=0.40
Requires-Dist: numpy>=2.2.0
Requires-Dist: openpyxl>=3.1.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: rich>=13.0.0
Requires-Dist: scikit-learn>=1.3.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://github.com/jeslago/epftoolbox), this library provides a flexible, extensible framework for downloading energy market data, building forecasting models, and evaluating their performance.

📖 **[Documentation](https://dawidlinek.github.io/epftoolbox2)** 

## Installation

```bash
pip install epftoolbox2
```

or with uv 

```bash
uv add epftoolbox2
```


## 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
- **Multithreading**: Multithreading with free GIL support in python 3.13t and above
- **Extensibility**: Extensible base classes for data sources, transformers, validators, models, evaluators, and exporters

## Quick Start

### Standalone source use

```python
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

```python
from epftoolbox2.data.transformers import ResampleTransformer

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

### Standalone validator use

```python
from epftoolbox2.data.validators import NullCheckValidator

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

### Standalone model use

```python
from epftoolbox2.models import OLSModel

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

### Standalone evaluator use

```python
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

```python
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.

```python
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.

```python
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", "weekday"], name="OLS"))
    .add_model(LassoCVModel(predictors=["load_actual", "weekday"], 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.