Python-Matplotlib 2 Numpy

Python-Matplotlib 2 Numpy

 

 

import numpy as np
arr = np.random.random(size=10)
print(arr)
print('{0} :  {1}'.format('min'.ljust(10), arr.min()))
print('{0} :  {1}'.format('max'.ljust(10), arr.max()))
#print('{0} :  {1}'.format('median'.ljust(10), np.median(arr)))
print('{0} :  {1}'.format('mean'.ljust(10), arr.mean()))
#print('{0} :  {1}'.format('variance'.ljust(10), arr.variance()))
print('{0} :  {1}'.format('sort'.ljust(10), arr.sort()))

Result

[ 0.78305111  0.76055492  0.44443505  0.9066785   0.30952056  0.52850392
  0.87953433  0.48186146  0.11761803  0.60087449]
min        :  0.11761802735764193
max        :  0.9066785032716341
mean       :  0.5812632368426661
sort       :  None

  

posted @ 2017-02-16 10:49  ZSR0401  阅读(270)  评论(0编辑  收藏  举报