NumPy reshape(), zeros(), ones(), full() and eye() Functions
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
# reshape(),zeros(),ones(),full(),eye()
import numpy as np
ar=np.eye(5,dtype="int")
print(ar)
ar1=np.ones((5,5),dtype="int")
print(ar1)
# value=int(input("Enter Value"))
# ar=np.full((3,4),value)
# print(ar)
# ar=np.ones((3,4),dtype="float")
# print(ar)
# ar=np.zeros((3,4),dtype="int32")
# print(ar)
# ar1=ar.reshape(4,3)
# print(ar1)
# ar=np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])
# print(ar)
# print(ar.shape)
# print("-------------------------------------------")
# ar1=ar.reshape(4,3)
# print(ar1)
# print("-------------------------------------------")
# print(ar)
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

