This project provides a Python implementation of an imputation method for energy time series. The CPI method copies data blocks with similar characteristics and pastes them into gaps of the time series while preserving the total energy of each gap.
This repository contains the Python implementation of the Copy-Paste Imputation (CPI) method presented in the following paper:
M. Weber, M. Turowski, H. K. Çakmak, R. Mikut, U. Kühnapfel and V. Hagenmeyer, 2021, "Data-Driven Copy-Paste Imputation for Energy Time Series," in IEEE Transactions on Smart Grid, 12, 6, pp. 5409–5419, doi: 10.1109/TSG.2021.3101831.
To install this project, perform the following steps:
cd
into the cloned directorypip install .
or pip install -e .
to install the project editable.
pip install -e .[dev]
to install with development dependenciesfrom cpiets.cpi import CopyPasteImputation
import pandas as pd
cpi = CopyPasteImputation()
data = pd.read_csv('data.csv')
cpi.fit(data)
result = cpi.impute()
Example data:
time | energy |
---|---|
2012-01-02 00:15:00 | 11.60 |
2012-01-02 00:30:00 | 24.87 |
2012-01-02 00:45:00 | 37.31 |
The names of the columns are arbitrary.
Assumptions:
Supported time formats:
In this repository, we included example data derived from the ElectricityLoadDiagrams20112014 data set.
To run the CPI method with simple test data, you can run the example
python example/simple_imputation.py
and play around with the parameters.
This project is supported by the Helmholtz Association under the Joint Initiative "Energy System 2050 - A Contribution of the Research Field Energy".
This code is licensed under the LGPL-3.0 License.