Skip to main content

Compute and plot PMFs for Binomial, Geometric, Negative Binomial and Poisson distributions.

Reason this release was yanked:

Installation error

Project description

Discrete PMF — Python Module for Plotting PMFs of Discrete Distributions

Discrete PMF is a lightweight and easy-to-use Python module for computing and visualizing Probability Mass Functions (PMFs) of common discrete probability distributions. It is ideal for educators, data scientists, statisticians, and learners who want to visualize and interact with probability distributions in Python.


Supported Distributions

  • Binomial Distribution
  • Geometric Distribution
  • Negative Binomial Distribution
  • Poisson Distribution

Each function:

  • Computes the PMF for a given distribution
  • Optionally generates a matplotlib stem plot
  • Returns the PMF values as a dictionary for further processing

Requirements

  • Python ≥ 3.6
  • matplotlib (for plotting)
  • Standard Library: math

Install dependencies with:

pip install matplotlib

Or if you're using Poetry:

poetry add matplotlib

Function Overview

🔹 binom_pmf(x_values, n, p_list, plot=True)

Compute and (optionally) plot the Binomial PMF.

Parameters:

  • x_values (List[int]): Values of the random variable X (e.g., [0, 1, 2, ..., n])
  • n (int): Number of trials
  • p_list (List[float]): List of success probabilities (e.g., [0.3, 0.7])
  • plot (bool): If True, displays a matplotlib stem plot (default: True)

Returns:

  • Dict[float, List[float]]: Mapping from each p to its list of PMF values.

Example:

from discrete_pmf import binom_pmf

x = list(range(0, 6))
n = 5
p_values = [0.3, 0.7]

binom_pmf(x_values=x, n=n, p_list=p_values, plot=True)

📚 Documentation

Each function includes Python docstrings explaining:

  • Function purpose
  • Parameters and types
  • Return values
  • Example usage

📝 License

MIT License. See LICENSE file for details.


🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change or add.

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

discrete_pmf-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

discrete_pmf-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file discrete_pmf-0.1.1.tar.gz.

File metadata

  • Download URL: discrete_pmf-0.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-21-generic

File hashes

Hashes for discrete_pmf-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3147486962d2c7881627b528afe36f4f41df402f75612e1f6d99ad92b0311b8
MD5 0386f35e5e8ff072751ad0437a95a33d
BLAKE2b-256 04ef98cb551e58bd20fd8a480eb030dbf238e02c5c88caefa1a4cb8ff535c83f

See more details on using hashes here.

File details

Details for the file discrete_pmf-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: discrete_pmf-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-21-generic

File hashes

Hashes for discrete_pmf-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2e55d08b68bfa56d17bd22da7dfe90d4395c02478b7b465167f6256494b73e7
MD5 6a1ebc5210a3d8c0abbc7a21f6ee1510
BLAKE2b-256 c6f618fa34b1715d317d982ae4ddf1629dd69d4872f18df2987337cd0cd5d762

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