In [2]:
import numpy as np
In [3]:
x = np.array([1,2,3,4,5,])
In [4]:
x
Out[4]:
In [5]:
x[1]
Out[5]:
In [6]:
x[:2]
Out[6]:
In [7]:
x[-3:]
Out[7]:
In [8]:
x = np.array([[11,12,13,14,15,], [21, 22, 23, 24, 25, ], [31, 32, 33, 34, 35,]])
In [9]:
x
Out[9]:
In [10]:
x.shape
Out[10]:
In [11]:
x[0]
Out[11]:
In [15]:
x[0] == x[0,:]
Out[15]:
In [12]:
x[0, 1]
Out[12]:
In [13]:
x[1, 1:-2]
Out[13]:
In [16]:
x[:,1]
Out[16]:
In [17]:
x.mean(axis=0)
Out[17]:
In [18]:
x.mean(axis=1)
Out[18]:
In [19]:
x.flatten()
Out[19]:
In [20]:
x.T
Out[20]:
In [22]:
x = np.array([
[
range(111, 116),
range(121, 126),
range(131, 136),
range(141, 146),
],
[
range(211, 216),
range(221, 226),
range(231, 236),
range(241, 246),
],
[
range(311, 316),
range(321, 326),
range(331, 336),
range(341, 346),
],
]
)
In [23]:
x
Out[23]:
In [24]:
x[0]
Out[24]:
In [25]:
x.mean(axis=0)
Out[25]:
In [26]:
x.mean(axis=1)
Out[26]:
In [27]:
x.mean(axis=2)
Out[27]:
In [28]:
x.shape
Out[28]:
In [30]:
y = x.reshape(x.shape[0], x.shape[1]*x.shape[2])
In [31]:
y.shape
Out[31]:
In [32]:
y.mean(axis=0)
Out[32]:
In [34]:
a = x[0]
a
Out[34]:
In [36]:
b = x[1]
b
Out[36]:
In [37]:
np.multiply?
In [39]:
np.dot(a,b.T)
Out[39]:
In [45]:
a = np.array([[1, 2,],[3, 4]])
In [46]:
a
Out[46]:
In [44]:
b = np.array([[10, 20,],[30, 40]])
In [47]:
b
Out[47]:
In [48]:
np.dot(a,b)
Out[48]:
In [52]:
np.dot(a[0,:], b[:,1])
Out[52]:
In [ ]: