Home > OS >  How to change float64 to double in numpy
How to change float64 to double in numpy

Time:12-06

The objective is to convert from float64 to double.

However, using the astype(np.double) does not changed the array type.

numpy.random.seed(0)
arr=np.random.rand(32,30,30)
arr1=arr.astype(np.double)
print(f'arr:{arr.dtype} and arr1: {arr1.dtype}')

arr:float64 and arr1: float64

CodePudding user response:

import numpy as np
np.double is np.float64 # returns True

As you can see they are virtually the same

You can see that in the docs here where it is mentioned that np.float64 is just an alias for np.double

  • Related