Numpy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy
 
 
 
incomes = numpy.random.normal(27000, 15000, 10000)
 
numpy.mean(incomes)
 
 
 
# %matplotlib inline
 
import matplotlib.pyplot as pyplot
 
pyplot.hist(incomes, 50)
 
pyplot.show()
 
 
 
print numpy.mean(incomes) # 27066
 
print numpy.median(incomes) # 26820
 
 
 
incomes = numpy.append(incomes, [1000000000])
 
 
 
print numpy.mean(incomes) # 127053
 
print numpy.median(incomes) # 26822

Leave a Comment