Site icon DataFlair

NumPy arrange(), linspace and logspace Functions

Machine Learning courses with 110+ Real-time projects Start Now!!

Program 1

# arange() , linspace(), logspace()
# use to create a array with Numerical values
# return type of all above functios are range value
#np.arange(start,stop,step,type)

import numpy as np

ar=np.logspace(1,5,5,dtype="int")
print(ar)

#linespace
# ar=np.linspace(1,10,5,dtype="float")
# print(ar)
# print("------------------------------------")

# ar1=np.arange(1,10,5,dtype="int32")
# print(ar1)

#ar=np.arange(1,100,2,dtype="int32")
# ar=np.arange(10,1,-1,dtype="int32")
# print(ar)
# print(ar.dtype)
# print(ar.itemsize)

 

Exit mobile version