Skip to main content

A package to calculate distributions (normal or binomial) sum, plot, mean and standard deviation.

Project description

The Package distributionsx does:

  • calculate mean, standard deviation, pdf and sum of normal and binomial distributions (when p value is same for both).
  • plot histogram for normal distribution and bar plot for binomial distribution.
  • plot pdf

Files

  • GeneralDistribution.py: It has the parent class Distribution inherited by Gaussiandistribution and Binomialdistribution in Gaussiandistribution.py and Binomialdistribution.py files respectively. It's read_data_file method reads the text data file, save it in self.data in init magic method and also calculate mean and standard deviation and save it on the self object.

  • Gaussiandistribution.py: This file contains the child class Gaussiandistribution that inherits from GeneralDistribution and caculate mean, standard deviation for normal distribution using mathematical formulas written in python using in built modules (math) and other libraries (numpy). It also codes the magic method for the addition of two normal distributions by adding their means and summing their standard deviations by taking the square root of the sum of the square of the standard deviations of both distributions objects. It also has methods for plotting the histogram, and calculating and plotting the pdf. The repr method outputs the characteristics of the Gaussian instance.

  • Binomialdistribution.py: This file contains the child class Binomialdistribution that inherits from GeneralDistribution and caculate mean, standard deviation for binomial distribution. It also codes the magic method for addition of two binomial distributions when the probability of the success(p) for both is same. It also has methods for plotting bar graph, and calculating and plotting the pdf. The repr method outputs the characteristics of the Binomial instance.

Package installation:

pip install distributionsx

Examples

  • open a python shell in terminal after installing the package.

python

  • import the package in the python shell.

from distributionsx import Gaussian, Binomial

  • Create a Gaussian object with mean 10 and standard deviation 5 and check the output in the terminal:

Gaussian(10, 5)

  • Create a Gaussian object with probability 0.5 and number of trials 10 and check the output (mean, standard deviation, probability of an event occuring, and number of trials) in the terminal:

Binomial(0.5, 10)

Project details


Release history Release notifications | RSS feed

This version

3.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distributionsx-3.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file distributionsx-3.0.tar.gz.

File metadata

  • Download URL: distributionsx-3.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.3

File hashes

Hashes for distributionsx-3.0.tar.gz
Algorithm Hash digest
SHA256 937007b7c931ac2e3e54106e0c497f475d833a38ee6e3f441738169863aa7fc3
MD5 48761eb42f012c81989a8978b97cec06
BLAKE2b-256 b4600f5ff431d03da80a7ea4c35651abc7fbc2053ab265b1504fe254590eb6a0

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