Skip to main content

Package Sampling

A Python implementation of various probability-based sampling algorithms, inspired by the R package sampling. This package offers a variety of sampling methods like Tillé's Method, Poisson Sampling, Systematic Sampling, and more, designed for unequal probability sampling. The algorithms are implemented in a way that supports both theoretical understanding and real-world use cases.

Installation

You can install the package directly from PyPI:

pip install package-sampling

Usage Example

from package_sampling.sampling import up_brewer
import numpy as np

pik = np.array([0.1, 0.2, 0.3, 0.4])

# Draw a sample using Brewer's method
samples = up_brewer(pik)
print(samples)

Authors

Mohammadreza Razavian - smrrazavian@outlook.com Bardia Panahbehagh - Panahbehagh@khu.ac.ir

Citation

If you use this package in your work, please cite it as follows:

APA Style

Razavian, M., & Panahbehagh, B. (2025). Package Sampling: A Python implementation of various probability-based sampling algorithms. https://github.com/smrrazavian/package-sampling.

BibTex

@misc{razavian2025packagesampling,
  author = {Razavian, Mohammadreza and Panahbehagh, Bardia},
  title = {Package Sampling: A Python implementation of various probability-based sampling algorithms},
  year = {2025},
  url = {https://github.com/smrrazavian/package-sampling}
}

Acknowledgments

This package is inspired by the R package "Sampling" Thanks to all contributors and users

Contributing

We welcome contributions to the package! If you have suggestions for new algorithms, improvements, or bug fixes, feel free to fork the repository and submit a pull request. Please ensure that your code adheres to the existing style and includes tests for any new functionality. Steps to Contribute:

  1. Fork the repository.
  2. Clone your fork to your local machine.
  3. Create a new branch for your changes.
  4. Make your changes and commit them with clear messages.
  5. Push your changes to your fork.
  6. Open a pull request describing your changes.

Metadata

Release files for package-sampling 1.0.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 package-sampling 1.0.0
File Size Uploaded
package_sampling-1.0.0.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for package-sampling 1.0.0
File Interpreter ABI Platform
package_sampling-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.0 kB

Release files / package_sampling-1.0.0.tar.gz

Download URL package_sampling-1.0.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d06f1e177fb38b45fc7b3179ce66a022b5248d71080c828df6729be6a1d616d4
BLAKE2b-256 checksum
How to use checksums
784042a73901213270866fa2e2a0f7ef8fae603ba9c7d1d716ae386e15c3da2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.14.0-33-generic

Release files / package_sampling-1.0.0-py3-none-any.whl

Download URL package_sampling-1.0.0-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df7cb339a59399e0e0aa69ba9630c606a61814bd0dc1eac8801f07de43ab2447
BLAKE2b-256 checksum
How to use checksums
9e94c6bd3981113a222e6367296ff8addc67be0e68a475ea45888a1eed995689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.14.0-33-generic

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

1 release file

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