Skip to main content
https://img.shields.io/pypi/v/resample.svg https://img.shields.io/conda/vn/conda-forge/resample.svg https://github.com/resample-project/resample/actions/workflows/test.yml/badge.svg https://coveralls.io/repos/github/resample-project/resample/badge.svg https://readthedocs.org/projects/resample/badge/?version=stable https://img.shields.io/pypi/l/resample https://zenodo.org/badge/145776396.svg

Link to full documentation

Resampling-based inference in Python based on data resampling and permutation.

This package was created by Daniel Saxton and is now maintained by Hans Dembinski.

Features

  • Bootstrap resampling: ordinary or balanced with optional stratification

  • Extended bootstrap resampling: also varies sample size

  • Parametric resampling: Gaussian, Poisson, gamma, etc.)

  • Jackknife estimates of bias and variance of any estimator

  • Compute bootstrap confidence intervals (percentile or BCa) for any estimator

  • Permutation-based variants of traditional statistical tests (USP test of independence and others)

  • Tools for working with empirical distributions (CDF, quantile, etc.)

  • Depends only on numpy and scipy

Example

We bootstrap the uncertainty of the arithmetic mean, an estimator for the expectation. In this case, we know the formula to compute this uncertainty and can compare it to the bootstrap result. More complex examples can be found in the documentation.

from resample.bootstrap import variance
import numpy as np

# data
d = [1, 2, 6, 3, 5]

# this call is all you need
stdev_of_mean = variance(np.mean, d) ** 0.5

print(f"bootstrap {stdev_of_mean:.2f}")
print(f"exact {np.std(d) / len(d) ** 0.5:.2f}")
# bootstrap 0.82
# exact 0.83

The amazing thing is that the bootstrap works as well for arbitrarily complex estimators. The bootstrap often provides good results even when the sample size is small.

Installation

You can install with pip.

pip install resample

Metadata

Release files for resample 1.10.3

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

Source distribution (sdist)

Source distribution for resample 1.10.3
File Size Uploaded
resample-1.10.3.tar.gz 632.1 kB Details

Built distribution (wheel)

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

Total release size: 652.4 kB

Release files / resample-1.10.3.tar.gz

Download URL resample-1.10.3.tar.gz
Size 632.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56d98049e85da72de019872e5ecb17a15eef753917664f626c1787e30d8674be
BLAKE2b-256 checksum
How to use checksums
4615d0b556364c38998f72bdc4b21b6b420e4b1e1880095ecdb74ce9b6700485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 4, 2026.

Transparency log

Release files / resample-1.10.3-py3-none-any.whl

Download URL resample-1.10.3-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
204fbc2b181c5e59176db31708ec91f4808eea4aa529ed2e70697244c47ce757
BLAKE2b-256 checksum
How to use checksums
e8b868b4fc06e53a1bd47e275af9c1670c175778e1f7fc2efff801ec142b262f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 4, 2026.

Transparency log
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