Skip to main content

Utility library for detecting and removing outliers from normally distributed datasets using the Smirnov-Grubbs test.

Requirements

Overview

Both the two-sided and the one-sided version of the test are supported. The former allows extracting outliers from both ends of the dataset, whereas the latter only considers min/max outliers. When running a test, every outlier will be removed until none can be found in the dataset. The output of the test is flexible enough to match several use cases. By default, the outlier-free data will be returned, but the test can also return the outliers themselves or their indices in the original dataset.

Examples

  • Two-sided Grubbs test with a Pandas series input

>>> from outliers import smirnov_grubbs as grubbs
>>> import pandas as pd
>>> data = pd.Series([1, 8, 9, 10, 9])
>>> grubbs.test(data, alpha=0.05)
1     8
2     9
3    10
4     9
dtype: int64
  • Two-sided Grubbs test with a NumPy array input

>>> import numpy as np
>>> data = np.array([1, 8, 9, 10, 9])
>>> grubbs.test(data, alpha=0.05)
array([ 8,  9, 10,  9])
  • One-sided (min) test returning outlier indices

>>> grubbs.min_test_indices([8, 9, 10, 1, 9], alpha=0.05)
[3]
  • One-sided (max) tests returning outliers

>>> grubbs.max_test_outliers([8, 9, 10, 1, 9], alpha=0.05)
[]
>>> grubbs.max_test_outliers([8, 9, 10, 50, 9], alpha=0.05)
[50]

License

This software is licensed under the MIT License.

Release files for outlier-utils 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for outlier-utils 0.0.5
File Size Uploaded
outlier_utils-0.0.5.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for outlier-utils 0.0.5
File Interpreter ABI Platform
outlier_utils-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / outlier_utils-0.0.5.tar.gz

Download URL outlier_utils-0.0.5.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
16e46fa6f7b01fe5518ea73fc15d3de0e30091750c428760bbe7dde2c9590579
BLAKE2b-256 checksum
How to use checksums
293a73493f0d4ee662798b27b0287d4372d99d3339ba5c3801caa14d5bf4d26d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / outlier_utils-0.0.5-py3-none-any.whl

Download URL outlier_utils-0.0.5-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e16148a3fa7b2e16ad0a3b75d8c8920828b5cc11568795782d597d4cfb0b194
BLAKE2b-256 checksum
How to use checksums
5702281e0d898e50138b4275d8f2840d5b6bd41b276cb697dd56fd56ac91262c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

3 release files

0.0.2

2 release files

0.0.1

2 release files

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