July 2017
Beginner to intermediate
420 pages
10h 56m
English
Just to prove a point, let's add in an outlier. We'll take Donald Trump; I think he qualifies as an outlier. Let's go ahead and add his income in. So I'm going to manually add this to the data using np.append, and let's say add a billion dollars (which is obviously not the actual income of Donald Trump) into the incomes data.
incomes = np.append(incomes, [1000000000])
What we're going to see is that this outlier doesn't really change the median a whole lot, you know, that's still going to be around the same value $26,911, because we didn't actually change where the middle point is, with that one value, as shown in the following example:
np.median(incomes)
This will output the following:
Out[5]: 26911.948365056276 ...
Read now
Unlock full access