Skip to main content

Automatic control chart calculation and plotting for the u'-chart.

Project description


by Dashlane

A python implementation the u'-chart.

The u'-chart is a control chart for attributes data that can handle large and variable sample sizes by counteracting overdispersion as described in the following paper: David B. Laney (2002) Improved Control Charts for Attributes, Quality Engineering, 14:4, 531-537, DOI: 10.1081/QEN-120003555.

The u'-chart is used to evaluate an attribute statistic over a period of time to determine whether or not the variation in the statistic can be explained by random variation alone.

This module includes customizable options that facilitates its use as an alerting system.

Author: Robert Astel

TL;DR: Implementation of u'-prime control chart rules that can be used for creating alerts on statistics with high/variable sample sizes.

Get Started


pip install uprime


from uprime import Uprime

# Four required arguments:
  # 1. Pandas Dataframe
  # 2. Name of the column by which the data can be chronologically sorted
  # 3. Name of the column that contains the number of occurrences of the attribute of interest
  #    The number of occurrences should always be an integer.  Non-integer values will be rounded.
  # 4. Name of the column that contains the size of the subgroup (A.K.A. sample)
  #    The subgroup size should always be an integer.  Non-integer values will be rounded.
up = Uprime(df, 'sort_column_name', 'occurrences_column_name', 'subgroup_size_column_name')

# Perform u'-chart calculations
# Return a Pandas DataFrame that contains all necessary data to plot a u'-chart or trigger alerts 
up_df = up.frame()


method = rolling, periods = 30

This configuration performs u'-chart calculations using the previous rolling 30 periods for each subgroup.

This is different from the default method = 'all', which uses all subgroups in the DataFrame df to perform the calculations`.

up = Uprime(df, 'sort_column_name', 'occurrences_column_name', 'subgroup_size_column_name', 
            method = 'rolling', periods = 30)

More examples, including usage of other optional arguments and built in charting function.


Read our to learn about our development process.


uprime is licensed under the Apache License 2.0

Project details

Download files

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

Files for uprime, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size uprime-1.1-py3-none-any.whl (11.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size uprime-1.1.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page