Skip to main content

prspace

Probability spaces with the same syntax in Python and R: Pr[X == 0] = 0.25.

Alpha. The API may change between 0.x releases.

import math
from prspace import PrSpace, Event

n_samples = math.comb(19, 10)
Pr = PrSpace()
S_B = Event()

for B in (100, 1000):
    Pr[S_B == 0] = math.prod(1 - k / n_samples for k in range(B))
    Pr[S_B >= 1] = 1 - Pr[S_B == 0]
    print("Pr[S_B >= 1] =", Pr[S_B >= 1])

print(Pr)
# PrSpace with 2 probabilities:
#   Pr[S_B == 0] = 0.004397413
#   Pr[S_B >= 1] = 0.9956026
  • Complements are derived: after Pr[X == 0] = 0.25, Pr[X != 0] and Pr[~(X == 0)] are 0.75.
  • Reading a condition that was never assigned raises UndefinedProbabilityError (a KeyError).
  • Event names are inferred from the variable they're bound to, or pass Event("name").

The R package has the same syntax. See the repository for both.

Metadata

Release files for prspace 0.1.0

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

Source distribution (sdist)

Source distribution for prspace 0.1.0
File Size Uploaded Provenance
prspace-0.1.0.tar.gz 4.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for prspace 0.1.0
File Interpreter ABI Platform
prspace-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / prspace-0.1.0.tar.gz

Download URL prspace-0.1.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2a2bc8d8a5f971bc49478bcfc341e960a5710e134f563a5c2eef7791013396e7
BLAKE2b-256 checksum
How to use checksums
2ad6e95d4112380c0c1d9bd66dd9b73c18dda288cf13b02b29bfba750323970f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Sep 26, 2026.

Transparency log

Release files / prspace-0.1.0-py3-none-any.whl

Download URL prspace-0.1.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b5917a5cbd070803f2f6896be6a4254f4461d2a72bf03d0c29fd2f8a16269a4
BLAKE2b-256 checksum
How to use checksums
053a5b1dfa7101b0959b85f48d45c75b7a2b96cec588f0b1ccf53500fd3875ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Sep 26, 2026.

Transparency log

Security for prspace 0.1.0

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prspace-0.1.0.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 Sep 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

0.1.0 This release

2 release files 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