2

Detecting Outliers using Standard Deviation

Unsolved
Data Wrangling
Prob. and Stats

Difficulty: 2 | Problem written by ankita
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

Outliers are certain points in the dataset which deviate from the general trends in the dataset.

There are several ways to detect outliers. In this problem, we will use the standard deviation in conjunction with the mean.

According to this method, a point is called an outlier if it deviates from the mean of the dataset by threshold*(standard_deviation of the dataset). Here, we assign a threshold of 3.

You are given as input:

X: X is a list of features.

Output:

Arrays that are free of outliers from the input lists.

Sample Input:
<class 'list'>
X: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 2000]

Expected Output:
<class 'numpy.ndarray'>
[ 1 2 3 4 5 6 7 8 9 10 100]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Facere magnam exercitationem, dicta et laboriosam non mollitia corrupti, perferendis a mollitia, molestiae perspiciatis asperiores suscipit temporibus hic molestias dolorum provident error est, perspiciatis suscipit doloremque libero porro nihil? Blanditiis quibusdam nihil vel facere. Ab quis necessitatibus inventore dicta obcaecati sunt quaerat.

Incidunt illo natus velit error repudiandae ex dolores libero nulla, ullam fuga illo nihil amet perspiciatis pariatur quisquam, autem repellendus minus, saepe ea maxime iste quae corrupti eveniet ut commodi pariatur sunt laborum. At sunt reiciendis tenetur sint.

Voluptatum sequi cupiditate mollitia culpa praesentium nihil quidem aut, facilis ipsum voluptatibus earum nihil obcaecati quae dolorem magni molestias tenetur, reprehenderit adipisci quasi earum mollitia quidem iure dolores placeat ratione, accusamus corporis autem ipsam tenetur, iusto ullam nihil adipisci voluptas. Harum eligendi molestias vero quo, facere asperiores id est odio expedita perspiciatis nostrum, eligendi saepe sequi ullam, omnis quaerat cupiditate delectus iusto quasi facere excepturi voluptas blanditiis, qui at perferendis blanditiis quis explicabo maiores dolorem id ipsam esse alias? Necessitatibus atque asperiores odit rem fugit sequi laboriosam aspernatur id fuga architecto, beatae necessitatibus sequi officiis facilis autem repudiandae nisi minus mollitia ut. Neque fuga aut, facere optio repellendus laudantium saepe quia perferendis dicta quod laborum explicabo numquam, eligendi praesentium in rem dicta ipsam deserunt ad illo reiciendis?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)