Skip to main content

Python

Install from PyPI:

pip install pragmastat==14.0.1

Source code: https://github.com/AndreyAkinshin/pragmastat/tree/v14.0.1/py

Pragmastat on PyPI: https://pypi.org/project/pragmastat/

Demo

from pragmastat import (
    Metric,
    Rng,
    Sample,
    Threshold,
    center,
    center_bounds,
    compare1,
    compare2,
    disparity,
    disparity_bounds,
    ratio,
    ratio_bounds,
    shift,
    shift_bounds,
    spread,
    spread_bounds,
)
from pragmastat.distributions import Additive, Exp, Multiplic, Power, Uniform


def main():
    # --- One-Sample ---

    x = Sample(list(range(1, 201)))

    result = center(x)
    print(result.value)  # 100.5
    bounds = center_bounds(x, 1e-3)
    print(f"Bounds(lower={bounds.lower}, upper={bounds.upper})")  # Bounds(lower=86.0, upper=115.0)
    print(spread(x).value)  # 59.0
    bounds = spread_bounds(x, 1e-3, seed="demo")
    print(f"Bounds(lower={bounds.lower}, upper={bounds.upper})")  # Bounds(lower=44.0, upper=87.0)

    # --- Two-Sample ---

    x = Sample(list(range(1, 201)))
    y = Sample(list(range(101, 301)))

    print(shift(x, y).value)  # -100.0
    bounds = shift_bounds(x, y, 1e-3)
    print(f"Bounds(lower={bounds.lower}, upper={bounds.upper})")  # Bounds(lower=-120.0, upper=-80.0)
    print(ratio(x, y).value)  # 0.5008354224706334
    bounds = ratio_bounds(x, y, 1e-3)
    print(
        f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
    )  # Bounds(lower=0.4066666666666668, upper=0.5958333333333332)
    print(disparity(x, y).value)  # -1.694915254237288
    bounds = disparity_bounds(x, y, 1e-3, seed="demo")
    print(
        f"Bounds(lower={bounds.lower}, upper={bounds.upper})"
    )  # Bounds(lower=-3.1025641025641026, upper=-0.8494623655913979)

    # --- Confirmatory Comparison ---

    x = Sample(list(range(1, 201)))
    projection = compare1(x, [Threshold(Metric.CENTER, 50.0, 1e-3)])[0]
    print(projection.verdict.value)  # greater

    x = Sample(list(range(1, 201)))
    y = Sample(list(range(101, 301)))
    projection = compare2(x, y, [Threshold(Metric.SHIFT, 0.0, 1e-3)])[0]
    print(projection.verdict.value)  # less

    # --- Randomization ---

    rng = Rng("demo-uniform")
    print(rng.uniform_float())  # 0.2640554428629759
    print(rng.uniform_float())  # 0.9348534835582796

    rng = Rng("demo-uniform-int")
    print(rng.uniform_int(0, 100))  # 41

    rng = Rng("demo-sample")
    print(rng.sample([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 3))  # [3, 8, 9]

    rng = Rng("demo-resample")
    print(rng.resample([1, 2, 3, 4, 5], 7))  # [3, 1, 3, 2, 4, 1, 2]

    rng = Rng("demo-shuffle")
    print(rng.shuffle([1, 2, 3, 4, 5]))  # [4, 2, 3, 5, 1]

    # --- Distributions ---

    rng = Rng("demo-dist-additive")
    print(Additive(0, 1).sample(rng))  # 0.17410448679568188

    rng = Rng("demo-dist-multiplic")
    print(Multiplic(0, 1).sample(rng))  # 1.1273244602673853

    rng = Rng("demo-dist-exp")
    print(Exp(1).sample(rng))  # 0.6589065267276553

    rng = Rng("demo-dist-power")
    print(Power(1, 2).sample(rng))  # 1.023677535537084

    rng = Rng("demo-dist-uniform")
    print(Uniform(0, 10).sample(rng))  # 6.54043657816832


if __name__ == "__main__":
    main()

Metadata

Release files for pragmastat 14.0.1

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

Source distribution (sdist)

Source distribution for pragmastat 14.0.1
File Size Uploaded Provenance
pragmastat-14.0.1.tar.gz 60.4 kB With provenance Details

Release files / pragmastat-14.0.1.tar.gz

Download URL pragmastat-14.0.1.tar.gz
Size 60.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8c019d5f688f6e1ae8ed5ae9353a9d43c57a56d040ca9376e04662009b1700b6
BLAKE2b-256 checksum
How to use checksums
7af56a2fe0086c84d1d8ed7010f34c866055a178c9e312d93993f16a6e9ecf95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

Security for pragmastat 14.0.1

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.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for pragmastat-14.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

14.0.1 This release

1 release file Full 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