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.0.tar.gz (46.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.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: time_series_transformers-0.1.0.tar.gz
  • Upload date:
  • Size: 46.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.0.tar.gz
Algorithm Hash digest
SHA256 788842555c905ca020cb47595722031a9499aab82e16a0b8954661bad2f2e5ef
MD5 27136ec84697d40ac419d2861bea8b03
BLAKE2b-256 2e678a268742dd5c89b555efe1f622829f5aaf6e583626aa2e9796248fee9c85

See more details on using hashes here.

Provenance

The following attestation bundles were made for time_series_transformers-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for time_series_transformers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f86719a84c531e86876b9569b2f986e832b549ba47e2fcba14b0863c3c914b41
MD5 538efc8c3608e3c3ac3e0d6a46282628
BLAKE2b-256 9780ecd03db66c16f98c859abbc8aa9d06d0cde7eafecdf19f1aef7db8183763

See more details on using hashes here.

Provenance

The following attestation bundles were made for time_series_transformers-0.1.0-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