Busabase
Busabase 是一款開源 (MIT) 資料庫與 AI agent 工作空間——將數據、文件、技能與應用程式整合於一處。您可以選擇本地運行、在網路內部進行自我託管,或使用 Busabase Cloud。
AI 翻譯
timeseries-shaper filters, transforms and engineer your timeseries dataframe
翻譯準備中
正在載入完整 README。
檢視完整 README ↗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.
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]"
import pandas as pd
from ts_shape import (
MachineStateEvents,
OutlierDetectionEvents,
concat,
make_timeseries,
profile,
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(profile(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.