Skip to main content

Python implementation of probability-based sampling algorithms inspired by the R package Sampling.

Project description

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.

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

package_sampling-1.0.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

package_sampling-1.0.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file package_sampling-1.0.0.tar.gz.

File metadata

  • Download URL: package_sampling-1.0.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for package_sampling-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d06f1e177fb38b45fc7b3179ce66a022b5248d71080c828df6729be6a1d616d4
MD5 18fcf62f01da5cfd51cf2f048704b79f
BLAKE2b-256 784042a73901213270866fa2e2a0f7ef8fae603ba9c7d1d716ae386e15c3da2d

See more details on using hashes here.

File details

Details for the file package_sampling-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: package_sampling-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.14.0-33-generic

File hashes

Hashes for package_sampling-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df7cb339a59399e0e0aa69ba9630c606a61814bd0dc1eac8801f07de43ab2447
MD5 1aed17bd3ee50335f165945612f0c818
BLAKE2b-256 9e94c6bd3981113a222e6367296ff8addc67be0e68a475ea45888a1eed995689

See more details on using hashes here.

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