Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change float64 to double in numpy

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading