Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

python - numpy array dtype is coming as int32 by default in a windows 10 64 bit machine

I have installed Anaconda 3 64 bit on my laptop and written the following code in Spyder:

import numpy.distutils.system_info as sysinfo
import numpy as np
import platform

sysinfo.platform_bits 
platform.architecture()

my_array = np.array([0,1,2,3])
my_array.dtype

Output of these commands show the following:

sysinfo.platform_bits 
Out[31]: 64

platform.architecture()
Out[32]: ('64bit', 'WindowsPE')

my_array = np.array([0,1,2,3])
my_array.dtype
Out[33]: dtype('int32')

My question is that even though my system is 64bit, why by default the array type is int32 instead of int64?

Any help is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Default integer type np.int_ is C long:

http://docs.scipy.org/doc/numpy-1.10.1/user/basics.types.html

But C long is int32 in win64.

https://msdn.microsoft.com/en-us/library/9c3yd98k.aspx

This is kind of a weirdness of the win64 platform.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...