efaciency
A package to simplify working with EFA blocks and settlement periods in the GB electricity trading system.
Installation
This package can be installed via pip:
$ pip install efaciency
Examples
Settlement periods
Get the starting timestamp for a settlement period.
>>> from datetime import date, datetime
>>> import efaciency
>>> efaciency.sp.to_ts(settlement_period=4) # defaults to today as settlement date
datetime.datetime(2025, 2, 18, 1, 30, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))
>>> efaciency.sp.to_ts(settlement_period=13, settlement_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 23, 6, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))
You can also get the settlement for a given timestamp:
>>> efaciency.sp.from_ts(ts=datetime(2025, 1, 12, 17, 30))
36
EFA blocks
Get the starting and ending timestamp for an EFA block.
>>> from datetime import date, datetime
>>> import efaciency
>>> efaciency.block.to_start_ts(efa_block=3) # defaults to today as EFA date
datetime.datetime(2025, 2, 18, 7, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))
>>> efaciency.block.to_start_ts(efa_block=1, efa_date=date(2025, 5, 23))
datetime.datetime(2025, 5, 22, 23, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))
You can also get the EFA block for a given timestamp:
>>> efaciency.block.from_ts(ts=datetime(2025, 1, 12, 17, 30))
5
What about clock change?
If a datetime with no timezone is provided, efaciency always assumes Europe/London timezone.
On clock change days, a tz-aware datetime must be passed or the fold parameter must be used.
>>> efaciency.sp.from_ts(datetime(2025, 10, 26, 1))
3
>>> efaciency.sp.from_ts(datetime(2025, 10, 26, 1).replace(fold=1))
5
Usage with Pandas or Polars
Examples of efaciency usage with Pandas or Polars dataframes:
# pandas
df["sp"] = df["ts"].apply(efaciency.sp.from_ts)
# polars
df.with_columns(pl.col("ts").map_elements(efaciency.sp.from_ts, return_dtype=pl.Int64).alias("sp"))
CLI
You can also use the efaciency CLI:
efaciency --help
Contribution
Please make a pull request or log an issue on GitHub.
License
Code is released as free software under the MIT License (see LICENSE file).
Metadata
Release files for efaciency 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| efaciency-0.4.1.tar.gz | 5.0 kB | Without provenance | Details for efaciency-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| efaciency-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for efaciency-0.4.1-py3-none-any.whl |
Total release size: 11.9 kB
Release files / efaciency-0.4.1.tar.gz
| Download URL | efaciency-0.4.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5ef4fa64bb8d9edc9213b218562abe627d89cc7b1f205676cceea849460fe2d
|
|
BLAKE2b-256 checksum How to use checksums |
a28aa48c88a3ec0da34cb6603c52a4a11c47ff087911500a5ed86f94356967e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / efaciency-0.4.1-py3-none-any.whl
| Download URL | efaciency-0.4.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1257b42cc3a602b2e6ec1fd47a1a0b27b63b6667f85e22e3e127fec28fd05317
|
|
BLAKE2b-256 checksum How to use checksums |
4f3d50714fa7245651bd7fe61be21174bff31fd070353d069c6e409ce648dfb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for efaciency 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.