In [47]:
x=25.0
In [48]:
pos=[2,4,5]
In [49]:
a=[[1,2,3],[4,5,6]]
In [50]:
a
Out[50]:
In [51]:
a[1][1]
Out[51]:
In [52]:
import numpy as np
In [53]:
np.zeros([3,4])
Out[53]:
In [54]:
np.ones([2,3,4],dtype=int)
Out[54]:
In [55]:
np.random.rand(3,4)
Out[55]:
In [56]:
a=[[1,2,3],[4,5,6]]
x=np.array(a)
In [57]:
x.shape
Out[57]:
In [58]:
x=np.random.rand(7)
print(x)
In [59]:
x[0]
Out[59]:
In [60]:
x[2]
Out[60]:
In [61]:
x[6]
Out[61]:
In [62]:
x[-1]
Out[62]:
In [63]:
x[-2]
Out[63]:
In [64]:
x[:2]
Out[64]:
In [65]:
x[-2:]
Out[65]:
In [66]:
x[2:5]
Out[66]:
In [67]:
x=np.random.rand(4,5)
print(x)
In [68]:
x[1:,2:4]
Out[68]:
In [69]:
x[2,1]
Out[69]:
In [70]:
x[:,:2]
Out[70]:
In [71]:
x[1:3, 1:3]
Out[71]:
In [72]:
x=np.random.rand(4,3,2)
print(x)
In [73]:
x.sum(axis=2)
Out[73]:
In [ ]: