Skip to main content

sklearn transformers for working with time series data

Project description

time-series-transformers

scikit-learn transformers for working with time series data.

time-series-transformers is a collection of scikit-learn-compatible transformers for common time series preprocessing tasks — scaling, log and signed-power transforms, differencing, detrending, and trend extraction. Every transformer operates directly on pandas DataFrames and preserves their index and column structure, follows the familiar fit / transform API, and — where it makes sense — implements inverse_transform so you can map results back to the original scale.

Installation

pip install time-series-transformers

Usage

All transformers accept and return pandas DataFrames:

import pandas as pd

from time_series_transformers import (
    DifferenceTransformer,
    InvertiblePipeline,
    LogTransformer,
)

data = pd.DataFrame({"price": [100.0, 102.0, 101.5, 105.0, 110.0]})

# Chain transforms; InvertiblePipeline undoes them in reverse order.
pipeline = InvertiblePipeline(
    [
        ("log", LogTransformer()),
        ("difference", DifferenceTransformer()),
    ]
)

transformed = pipeline.fit_transform(data)
recovered = pipeline.inverse_transform(transformed)  # back to the original prices

The package provides:

  • ScalingPandasStandardScaler, PandasMinMaxScaler
  • TransformsLogTransformer (log / signed-power)
  • StationarityDifferenceTransformer, DetrendTransformer, HamiltonFilterTransformer
  • CompositionInvertiblePipeline, DataFrameFeatureUnion

Contributing

Contributions are welcome! This project uses pixi to manage its development environment.

  1. Fork and clone the repository.
  2. Install the environment:
    pixi install
    
  3. Create a feature branch and make your changes, adding tests where appropriate.
  4. Run the checks before opening a pull request:
    pixi run test         # run the test suite
    pixi run mypy         # type-check
    pixi run pre-commit   # lint and format
    
  5. Open a pull request against main with a clear description of your change.

Please make sure the test suite passes and new code is covered by tests.

License

Released under the MIT License.

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

time_series_transformers-0.1.1.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

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

time_series_transformers-0.1.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file time_series_transformers-0.1.1.tar.gz.

File metadata

  • Download URL: time_series_transformers-0.1.1.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for time_series_transformers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee67517433b67c3a1356e926972c3b82d122a96093fcb566f02bb950fe678cd9
MD5 d906adc0686c7e25779e8edf5a57eaaf
BLAKE2b-256 ba14340a291781aaec5a49de32a37f998928c7874aca9c9c2ac1c1786ac28421

See more details on using hashes here.

Provenance

The following attestation bundles were made for time_series_transformers-0.1.1.tar.gz:

Publisher: release.yml on jessegrabowski/time_series_transformers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file time_series_transformers-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for time_series_transformers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b56cbe3c595243f74a6327d6433469126531eef7dee3460fc58cacf148063a4
MD5 ec6d8c9f132423b19ed86685c0230627
BLAKE2b-256 d3e7d56647464d6ec03c7b91d4590c7a372d8b0e14267047d6082e16aadb60c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for time_series_transformers-0.1.1-py3-none-any.whl:

Publisher: release.yml on jessegrabowski/time_series_transformers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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