supriya
supriya

Reputation: 1

Is it necessary to use "numpy.float64"?

i recently saw an example about "Linear regression"
where he uses while creating an array with numpy in order with dtype = numpy.float64

x = numpy.array([1,2,3,4] , dtype = numpy.float64)

i tried without flaot64 where it returns different value rather than error
why?

Upvotes: 0

Views: 2031

Answers (1)

Akshay Ghiya
Akshay Ghiya

Reputation: 21

What data type to use depends on the use case.

    x = numpy.array([1,2,3,4] , dtype = numpy.float64)

Here the elements of an array are of type float64 (Double precision float).

    x = numpy.array([1,2,3,4])

Here the elements are of type int64 (Integer)

Upvotes: 1

Related Questions