In [33]:
import numpy as np
In [2]:
A = np.array([[1,2,3]]); print(A)
In [3]:
B = np.array([[1,2,3],[4,5,6],[7,8,9]]); print(B)
In [4]:
C = np.zeros((2,1)); print(C)
In [5]:
D = np.ones((1,3)); print(D)
In [6]:
E = np.random.randn(3,3); print(E)
In [7]:
print(B)
In [41]:
B[0] #first row
Out[41]:
In [42]:
B[:,0] #first column
Out[42]:
In [9]:
B[0,0]
Out[9]:
In [10]:
B[2,2]
Out[10]:
In [11]:
B[:,0]
Out[11]:
In [12]:
print(B.dtype)
print(B.shape)
print(B.ndim)
print(B.size)
In [13]:
B.tolist()
Out[13]:
In [14]:
B.T
Out[14]:
In [15]:
B.reshape(1,9)
Out[15]:
In [16]:
B.flatten()
Out[16]:
In [17]:
A.nonzero()
Out[17]:
In [18]:
A
Out[18]:
In [19]:
A.min()
Out[19]:
In [20]:
A.max()
Out[20]:
In [21]:
A.sum()
Out[21]:
In [22]:
A.mean()
Out[22]:
In [23]:
A.var()
Out[23]:
In [24]:
A.std()
Out[24]:
In [25]:
A
Out[25]:
In [26]:
A*A
Out[26]:
In [27]:
A**A
Out[27]:
In [28]:
A/A
Out[28]:
In [29]:
A-A
Out[29]:
In [30]:
A+A
Out[30]:
In [31]:
A<B
Out[31]:
In [32]:
A==B
Out[32]: