create()
list()
tuple()
array()
size
dtype
ndim
shape
range()
space()
arange()
linspace()
What will be the output?
import numpy as np a = np.array([[1,2],[3,4]]) print(a.shape)
(4,)
(2,2)
(2,1)
4
How many values are generated?
import numpy as np print(np.linspace(0, 10, 6))
5
10
6
11
import numpy as np a = np.array([1,2,3]) b = np.array([4,5,6]) print(a+b)
[5 7 9]
[1 2 3 4 5 6]
21
Error
import numpy as npa a=np.array([1,2,3]) print(a*2)
[2 4 6]
[1 2 3 1 2 3]
[3 4 5]
Tuple of array dimensions
Total elements
Data type
Memory size
np.create()
np.array()
np.ndarray()
np.makearray()
2 rows, 3 columns of ones
3 rows, 2 columns of ones
6×6 matrix
1D array
itemsize
nbytes
memory
bytesize
list
tuple
dictionary
ndarray
[1,3,5,7,9]
[1,2,3,4,5]
[2,4,6,8]
astype()
convert()
change()
typecast()
float64
int32
int64
object