Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...