Skip to main content

ts-shape

PyPI Release Docs License: MIT

ts-shape is a pandas library for manufacturing and IIoT time series. It works on long-format signal data (systime, uuid, value_double / value_integer / value_bool / value_string) and provides loaders, filters, feature extraction and event detectors for production (OEE, downtime, shift reports, traceability), quality (outliers, SPC rules, capability), process engineering, maintenance, energy, supply chain and process development. Every detector takes a DataFrame and returns a DataFrame, and any detector output can be turned into an OCEL 2.0 or XES event log for process mining.

Install

pip install ts-shape

Python 3.11 or later. The core depends only on pandas, numpy and scipy. Loader backends and a few detectors need extras:

Extra Installs Needed for
parquet pyarrow reading parquet files
s3 s3fs, pyarrow S3 loaders
azure azure-storage-blob, pyarrow Azure Blob loaders
api requests REST metadata and energy API loaders
sql sqlalchemy TimescaleDB and SQL metadata loaders
postgres sqlalchemy, psycopg2-binary sql plus the PostgreSQL driver
yaml pyyaml signal specs and lambda rules from YAML
units pint UnitConverter
ml scikit-learn Isolation Forest outlier detection
all all of the above
pip install "ts-shape[parquet,azure]"

Example

import pandas as pd
from ts_shape import (
    MachineStateEvents,
    OutlierDetectionEvents,
    check_signals,
    concat,
    make_timeseries,
    to_event_log,
)

# Synthetic data in the standard format; use a loader or pandas for your own
temp = make_timeseries(["oven:temp"], n_points=1440, freq="1min", n_outliers=4)
running = make_timeseries(["oven:running"], n_points=1440, freq="1min", value_column="value_bool")
df = pd.concat([temp, running], ignore_index=True)

print(check_signals(df).summary())   # signal kinds, gaps, counter resets, duplicates

outliers = OutlierDetectionEvents(temp, value_column="value_double").detect_outliers_zscore(n_sigma=4.0)
intervals = MachineStateEvents(df, run_state_uuid="oven:running").detect_run_idle(min_duration="5min")

log = concat(
    to_event_log(outliers, detector="OutlierDetectionEvents.detect_outliers_zscore"),
    to_event_log(intervals, detector="MachineStateEvents.detect_run_idle"),
)
print(log.events[["ocel:activity", "ocel:timestamp"]].head())

ts_shape.list_detectors() lists the public classes (name, category, module): the detectors, and also the transform, feature, loader, event-log and pipeline classes. The examples/ folder has one self-contained script per area of the library.

Parts of this library were developed with the assistance of Claude, Anthropic's AI assistant. All code is reviewed and maintained by the project authors.

Metadata

Release files for ts-shape 0.0.94

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ts-shape 0.0.94
File Size Uploaded Provenance Actions
ts_shape-0.0.94.tar.gz 2.4 MB Without provenance Details for ts_shape-0.0.94.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ts-shape 0.0.94
File Interpreter ABI Platform Actions
ts_shape-0.0.94-py3-none-any.whl Python 3 none any Details for ts_shape-0.0.94-py3-none-any.whl

Total release size: 3.6 MB

Release files / ts_shape-0.0.94.tar.gz

Download URL ts_shape-0.0.94.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
38ede5804ba69a60e8724aed5377f401f4621dc99ec807d60a2e81c420f0a435
BLAKE2b-256 checksum
How to use checksums
3d05cf2c79c1310325c066543c156ff87e3bfba287b9e6b487da916d61a29d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / ts_shape-0.0.94-py3-none-any.whl

Download URL ts_shape-0.0.94-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
63ae908824b4ab94b6830c5cd2282ace3fa808cbc713c3e7fd8beb02e5f36fe3
BLAKE2b-256 checksum
How to use checksums
ddd6954ded4ea2541da859eb809d83541cb3284c31c45b19a64945c9d93411a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for ts-shape 0.0.94

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.

Release history Release notifications | RSS feed

This release

0.0.94 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page