In [1]:
import numpy as np
In [2]:
array=[1,2,3,4,5]
array+1#没定义成numpy.ndarray类型是不能直接操作的
In [3]:
array=np.array([1,2,3,4,5])
print(type(array))
In [6]:
array2=array+1
array2
Out[6]:
In [7]:
array*array2
Out[7]:
In [8]:
array[0]
Out[8]:
In [9]:
array.shape#数组大小
Out[9]:
In [10]:
np.array([[1,2,3],[4,5,6]])
Out[10]: