首页 > 代码库 > numpy ndarray

numpy ndarray

>>> a
array([[1, 2],
[3, 4]])
>>> a.shape
(2, 2)
>>> b
array([2, 3])
>>> b.shape
(2,)
>>> c
array([[1],
[2]])
>>> c.shape
(2, 1)
>>> d
array([[1, 2]])
>>> d.shape
(1, 2)

 

>>> d.sum(0)==e
array([ True, True], dtype=bool)
>>> e
array([1, 2])