1# Basic syntax:
2np.ones((number_rows, number_cols), dtype=int)
3
4# Example usage:
5import numpy as np
6np.ones((5, 3), dtype=int)
7array([[1, 1, 1],
8 [1, 1, 1],
9 [1, 1, 1],
10 [1, 1, 1],
11 [1, 1, 1]])
12
13# Note, use np.zeros to create an array of zeros
1import numpy
2print(numpy.ones((2, 3), dtype=int))
3# creates the array of the shape (2, 3) of value 1 in its each cell
4print(numpy.ones(6, dtype=str)
5# creates an array of size 6 with values of '1'