In [1]:
l1=[1,2,3,4]
In [1]:
import numpy as np
In [3]:
np.array(l1)
Out[3]:
In [4]:
l1
Out[4]:
In [5]:
a1=np.array(l1)
In [6]:
a1
Out[6]:
In [7]:
l2=[[1,2,3],[4,5,6],[7,8,9]]
In [8]:
l2
Out[8]:
In [9]:
np.array(l2)
Out[9]:
In [10]:
l2
Out[10]:
In [11]:
l2[1]
Out[11]:
In [12]:
l2[1][0]
Out[12]:
In [13]:
l2[1,0]
In [14]:
l2[2][2]
Out[14]:
In [17]:
a2=np.arange(10)
In [18]:
a2
Out[18]:
In [19]:
np.arange(2,5)
Out[19]:
In [20]:
np.arange(0,11,2)
Out[20]:
In [2]:
np.zeros(5)
Out[2]:
In [7]:
np.zeros((4,3))
Out[7]:
In [8]:
np.ones(5)
Out[8]:
In [9]:
np.ones((5,2))
Out[9]:
In [12]:
Out[12]:
In [15]:
np.linspace(1,100,80)
Out[15]:
In [16]:
np.eye(5)
Out[16]:
In [18]:
np.random.rand(20)
Out[18]:
In [19]:
np.random.rand(20,5)
Out[19]:
In [20]:
np.random.randn(2)
Out[20]:
In [21]:
np.random.randn(5)
Out[21]:
In [22]:
np.random.randn(6,6)
Out[22]:
No comments:
Post a Comment