'Remove not representative values from a list
I'm wondering how to remove not representative samples from the population.
Let's assume that I have following numbers as a list:
pop = [1, 2, 3, 4, 1, 3, 3, 4, 5, 7, 2, 1, 1, 1, 1, 1, 1002]
Is there any way to inspect the list and remove value 1002 as it is completely not representative and can disturb calculations?
To illustrate this let make the following computation:
>>> pop = [1, 2, 3, 4, 1, 3, 3, 4, 5, 7, 2, 1, 1, 1, 1, 1, 1002]
>>> mean(pop)
61.294117647058826
>>> pop1 = [1, 2, 3, 4, 1, 3, 3, 4, 5, 7, 2, 1, 1, 1, 1, 1]
>>> mean(pop1)
2.5
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
