Basic of Numpy Module of Python. Creating a NumPy array and reshape the array. Use of shape, ndim, dtype, size, type() of NumPy Module. I used Jupyter Notebook for practice.
Code:
import numpy as np
Code:
a = np.arange(15).reshape(3, 5)
a
Output:
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14]])
Code:
a.shape
Output:
(3, 5)
Code:
a.ndim
Output:
2
Code:
a.dtype
Output:
dtype('int64')
Code:
a.dtype.name
Output:
'int64'
Code:
a.size
Output:
15
Code:
type(a)
Output:
numpy.ndarray
Code:
b = np.array([6, 7, 8])
b
Output:
array([6, 7, 8])
Code:
type(b)
Output:
numpy.ndarray