1.a Numpy Code
1.a Numpy Code
a Numpy Code
In [3]:
## Numpy ( numerical for Python)
# It will provide more efficent storage and Data operation as size grows
import numpy as np
In [4]:
a = np.arange(15)
In [5]:
a
In [7]:
a.reshape(3,5)
[ 5, 6, 7, 8, 9],
In [8]:
a.ndim
Out[8]: 1
In [9]:
a.dtype.name
Out[9]: 'int32'
In [10]:
a
In [11]:
a.size
Out[11]: 15
In [12]:
a[1:3]
In [13]:
a[4:]
In [14]:
a[4]
Out[14]: 4
In [13]:
a[8]
Out[13]: 8
In [9]:
# Reverse the order of array
a[::-2]
In [12]:
x = a.reshape(3,5)
[ 5, 6, 7, 8, 9],
In [14]:
x[2]
In [19]:
# two rows and three columns
x[:2, :3]
[5, 6, 7]])
In [20]:
# three rows and two colums
x[:3, :2]
[ 5, 6],
[10, 11]])