numpy 之 array

Example1: initialization

import numpy as np

a = np.array([])
print a
print a.shape

Example2: append

import numpy as np

a = np.array([])
print a
print a.shape

value = 1
a = np.append(a,value)
print a
print a.shape

Example3: operators(均值,方差等)

import numpy as np

a = np.array([])
print a
print a.shape

value = 1
a = np.append(a,value)
print a
print a.shape

value = 2
a = np.append(a,value)
print a
print a.shape

print np.mean(a)
print np.var(a)

参考
https://docs.scipy.org/doc/numpy/reference/generated/numpy.append.html

你可能感兴趣的:(Python编程)