Skip to main content

Array Creation

np.array()

Creates a new array from a Python list or tuple

np.array([7,8,9,10,11,12])

np.zeros()

Creates an array filled with zeros

np.zeros((3,3))

np.ones()

Creates an array filled with ones

np.ones((2,3))

np.arrange()

Creates an array with a range of values

np.arrange((2,3))

np.random.random()

Creates an array with a range of values

np.random.random((2,3)) # 2 - no. of rows : 3 - no. of columns