Skip to main content

Designed to make time series forecasting workflows faster, safer, and more standardized.

Project description

TSTools

TSTools is a Python package for making time series forecasting workflows faster, safer, and more standardized.

It is intended to become a practical forecasting helper package for:

  • validating forecasting datasets
  • exploring time series structure quickly
  • supporting reusable forecasting workflows

Today, the implemented package starts with the first and most important layer of that vision: data sanity checks for forecast readiness.

sanity_checks(...) is designed for prepared forecasting data held in either:

  • pandas.DataFrame
  • pyspark.sql.DataFrame

Why TSTools

Forecasting projects often lose time because basic data problems are discovered too late:

  • invalid or inconsistent dates
  • duplicate time keys
  • missing timestamps
  • invalid target values
  • weak or broken grouped-series structure
  • messy regressor columns

TSTools is designed to catch those problems early, with an API that works well in notebooks, scripts, and pipeline-style checks.

Current Release

The current public workflow is centered on:

  • load_sample_data(...)
  • sanity_checks(...)

Current implemented package areas:

  • tstools.sanity forecast-readiness validation
  • tstools.datasets sample data for trying the API quickly

Planned package areas:

  • tstools.eda fast exploration and diagnostics for time series data
  • tstools.forecasting reusable forecasting helpers, baselines, and evaluation utilities

Install

Install from PyPI:

pip install tstools-forecast

Install from PyPI with Spark support:

pip install "tstools-forecast[spark]"

Import it as:

import tstools

For local development:

pip install tstools-forecast

For editable local development:

pip install -e .

For development tools:

pip install -e .[dev]

For editable local development with Spark support:

pip install -e .[spark]

Quickstart

from tstools import load_sample_data, sanity_checks

df = load_sample_data("sample_timeseries_dataframe")

report = sanity_checks(
    df,
    date_col="date",  # timestamp column for the time series
    target_col="sales",  # value column to validate for forecasting
    group_cols=["dfu"],  # key column(s) defining each individual series
    expected_freq="D",  # expected cadence, here daily
    min_history=10,  # minimum observations expected per series
    non_negative_target=True,
    integer_like_target=True,
    regressors={
        "categorical": ["promo_type"],
        "numerical": ["price"],
        "boolean": ["is_promo"],
    },
)

print(report.overall_status)
print(report.summary)

Use sanity_checks(...) once your forecasting dataset is already assembled into a modeling-ready table:

  • one date column
  • one or more target columns
  • optional key columns for panel data
  • optional regressor columns you want validated as model inputs

Supported dataframe backends in this release:

  • pandas: full current sanity-check surface
  • Spark (pyspark.sql.DataFrame): core structural sanity subset

Current Spark-specific note:

  • row-order monotonicity is pandas-only because Spark DataFrames do not carry stable row order semantics

Recommended first-time flow:

  1. install tstools-forecast
  2. import from tstools
  3. run load_sample_data("sample_timeseries_dataframe")
  4. inspect the printed report and report.summary

What The Current Sanity Module Covers

sanity_checks(...) currently covers:

  • required columns
  • duplicate column names
  • empty data / zero usable rows
  • null group keys
  • date parsing
  • monotonic timestamp order
  • duplicate keys and conflicting duplicate keys
  • missing dates and frequency consistency
  • numeric target validity
  • target domain constraints
  • missing targets
  • constant and all-zero series
  • short history
  • typed regressor validation for categorical, numerical, and boolean regressors

Spark v1 supports the core structural subset:

  • schema and required columns
  • empty input and null key columns
  • date parseability, missing dates, and cadence checks
  • duplicate and conflicting duplicate keys
  • target numeric/domain checks
  • missing targets
  • constant and all-zero series
  • regressor validation
  • short history

It is most useful after raw joins, filtering, and feature assembly are already done, and before EDA or modeling begins.

Sample Data

TSTools ships with one maintained public demo dataset:

  • sample_timeseries_dataframe

It is intentionally designed to exercise the current sanity-check surface in one dataframe, including:

  • invalid dates
  • missing dates
  • duplicate and conflicting duplicate keys
  • missing targets
  • constant and all-zero series
  • short history
  • target domain violations
  • invalid or missing regressors

Report Statuses

Overall report status:

  • READY
  • READY_WITH_WARNINGS
  • NOT_READY

Check status:

  • PASS
  • WARN
  • FAIL
  • INFO

Product Direction

The long-term goal is not just to validate data, but to support a fuller forecasting workflow:

  1. validate time series inputs
  2. explore and diagnose the data
  3. build repeatable forecasting utilities on top of clean inputs

Spark support is intentionally phased so the package can stay fast, explicit, and reliable while the backend surface grows.

Development

Run verification:

.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m bandit -q -r src

Docs

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

tstools_forecast-1.1.1b1.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

tstools_forecast-1.1.1b1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file tstools_forecast-1.1.1b1.tar.gz.

File metadata

  • Download URL: tstools_forecast-1.1.1b1.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tstools_forecast-1.1.1b1.tar.gz
Algorithm Hash digest
SHA256 280238f8aef9f7918d6068fea987cef8617ca14350136ef895b0d5ddb6cfaac0
MD5 b2d4c5800323e3978670551bce120613
BLAKE2b-256 655736661340caebe4d0b1255fefcdd358898cc17bd9ee021b7652c0ed8ce456

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstools_forecast-1.1.1b1.tar.gz:

Publisher: publish-prod.yml on rudreshmishra16/TSTools

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

File details

Details for the file tstools_forecast-1.1.1b1-py3-none-any.whl.

File metadata

File hashes

Hashes for tstools_forecast-1.1.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b6223ebcc928471505cfac95433464e654d1beeeeafb1ddc1bc15dd195e7465
MD5 7829ba8ff3c7ae23e80823f9e38722b9
BLAKE2b-256 36ffab43ccf0dc02c4e5719fdc0d9f33a68d2386516603ee4c0235d183c1f4ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstools_forecast-1.1.1b1-py3-none-any.whl:

Publisher: publish-prod.yml on rudreshmishra16/TSTools

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