Skip to main content

ts-shape

PyPI CI 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
import ts_shape
from ts_shape.eventlog import concat, to_event_log

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

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

outliers = ts_shape.OutlierDetectionEvents(temp, value_column="value_double").detect_outliers_zscore(threshold=4.0)
intervals = ts_shape.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 detector 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.65

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.65
File Size Uploaded
ts_shape-0.0.65.tar.gz 1.2 MB Details

Built distribution (wheel)

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

Total release size: 1.9 MB

Release files / ts_shape-0.0.65.tar.gz

Download URL ts_shape-0.0.65.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
e5ad74a60b86a85d2b5becfc9b8939c28e400147efcb46e8cef97f33d15f07d1
BLAKE2b-256 checksum
How to use checksums
0532f038147e72e4bd93e0d69f691f2d269d19c2532427a090e008a04cf64704
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.65-py3-none-any.whl

Download URL ts_shape-0.0.65-py3-none-any.whl
Size 641.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8146d81394cfaaa5d2c410140005eec863e497818ed1c0b3da14d92ce09c97ba
BLAKE2b-256 checksum
How to use checksums
eae169de497fe620a5e7b593f33024067e478e15f8e56435a64b6758749acb09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

0.0.69

2 release files

0.0.68

2 release files

0.0.67

2 release files

0.0.66

2 release files

This release

0.0.65 This release

2 release files

0.0.64

2 release files

0.0.63

2 release files

0.0.62

2 release files

0.0.61

2 release files

0.0.60

2 release files

0.0.59

2 release files

0.0.58

2 release files

0.0.57

2 release files

0.0.56

2 release files

0.0.55

2 release files

0.0.54

2 release files

0.0.52

2 release files

0.0.51

2 release files

0.0.50

2 release files

0.0.49

2 release files

0.0.47

2 release files

0.0.46

2 release files

0.0.45

2 release files

0.0.44

2 release files

0.0.43

2 release files

0.0.42

2 release files

0.0.41

2 release files

0.0.40

2 release files

0.0.39

2 release files

0.0.38

2 release files

0.0.37

2 release files

0.0.36

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.0

2 release files

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