Skip to main content

A Python package for removing outliers in dataset using the Interquartile Range technique.

Project description

Outlier Removal using Interquartile Range - Python

Project 2 : UCS633

Submitted By: Khushnuma Grover 101703289


pypi: https://pypi.org/project/outlier-removal-101703289
git: https://github.com/khushgrover/outlier-removal-python.git


What are Outliers ?

There are certain things which, if are not done in the Exploratory Data Analysis phase, can affect further statistical/Machine Learning modelling. One of them is finding Outliers.

In statistics, an outlier is an observation point that is distant from other observations.

Interquartile Range Method

A robust method for labelling outliers is the IQR (interquartile range) method of outlier detection developed by John Tukey, the pioneer of exploratory data analysis. This was in the days of calculation and plotting by hand, so the datasets involved were typically small, and the emphasis was on understanding the story the data told. A box-and-whisker plot (also a Tukey contribution), shows this method in action.

A box-and-whisker plot uses quartiles (points that divide the data into four groups of equal size) to plot the shape of the data. The box represents the 1st and 3rd quartiles, which are equal to the 25th and 75th percentiles. The line inside the box represents the 2nd quartile, which is the median.

The interquartile range, which gives this method of outlier detection its name, is the range between the first and the third quartiles (the edges of the box). Tukey considered any data point that fell outside of either 1.5 times the IQR below the first – or 1.5 times the IQR above the third – quartile to be outside or far out. In a classic box-and-whisker plot, the 'whiskers' extend up to the last data point that is not outside.


How to use this package:

In this package this method is implemented. It take in the dataset csv file and outputs out a csv file in the rows having outlier values are removed. This package handles univariate datasets as well as multivariate. Each feature having outlier rows are removed.

OUTLIER-REMOVAL-KHUSHNUMA-101703289 can be run as in the following example:

Installing the package

On your Command Prompt run the following command:

pip install outlier-removal-101703289

Sample dataset

The dataset should be constructed with each row representing a data, and each column representing a criterion feature, ending with a target.


Feature Target
10 0.62
100 0.44
100 0.31
100 0.67
10 0.56

In Command Prompt:

>> remove-outlier data.csv

In Python IDLE:

>>> from outlier_removal.outlier import remove_outlier
>>> file1 = pd.read_csv('data.csv')
>>> remove_outlier(file1)

Output

Feature Target
100 0.44
100 0.31
100 0.67

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

outlier-removal-101703289-1.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

outlier_removal_101703289-1.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file outlier-removal-101703289-1.0.2.tar.gz.

File metadata

  • Download URL: outlier-removal-101703289-1.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for outlier-removal-101703289-1.0.2.tar.gz
Algorithm Hash digest
SHA256 691ed1058473b0b33e61415c864dac2af544c2196434e138e190e4e1586e3d12
MD5 eb01263a83af1cf41e482eb1f046593c
BLAKE2b-256 9300d09af0fdff995c6881c11b4e61dbaad45f328bffbaee9542e31dab2dfb56

See more details on using hashes here.

File details

Details for the file outlier_removal_101703289-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: outlier_removal_101703289-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for outlier_removal_101703289-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efacc98a3f89d82200ee05797cd5aa0f4ad4bef0577bf9ef435a426a63de3231
MD5 033b09e7b5af5aacf7c396920e6b71bb
BLAKE2b-256 f3f2774e07d794e9840e6fdc6bbb3dcc055eb1dac0c241dfa4c7b22a25bc4423

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