Numpy简单语法

(1)
import numpy as np
a=(3,3)
b=(4,4)
c=a+b
print(c)

(3, 3, 4, 4)

(2)
import numpy as np

a = np.array(range(3), dtype=’float64’)
b = np.zeros(3)
a
array([ 0., 1., 2.])
b
array([ 0., 0., 0.])
test = a
test += np.ones(3)
a
array([ 1., 2., 3.])
test = b
test += np.ones(3)
b
array([ 1., 1., 1.])
a
array([ 1., 2., 3.])