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)

 

Your opinion matters
Please write your valuable feedback about DataFlair on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *