Numpy数组的长整数形状 [英] Long integer shape of Numpy arrays

查看:86
本文介绍了Numpy数组的长整数形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我像这样构造一个numpy矩阵:

If I construct a numpy matrix like this:

A = array([[1,2,3],[4,5,6]])

然后键入A.shape我得到结果:

(2L, 3L)

为什么我会得到一个长格式的形状?

Why am I getting a shape with the format long?

我可以重新启动所有内容,但仍然存在相同的问题.据我所知,只有在构造数组时才会出现此问题,否则会得到短(常规)整数.

I can restart everything and I still have the same problem. And as far as I can see, it is only when I construct arrays I have this problem, otherwise I get short (regular) integers.

推荐答案

正如@CédricJulien所说,在这种情况下,长数字没有问题-应该将其视为实现细节.

As @CédricJulien puts it on the comment, there is no problem with long numbers in this case - this should be treated as an implementation detail.

您问题的真正答案当然只能在numpy的源代码中找到,但是在这种情况下维数很长这一事实与您对数组或这些索引的任何使用无关紧要.

The real answer for your question can, of course, only be found inside numpy's source code, but the fact that the dimensions are long in this case should not matter for any use you have for the arrays or these indexes.

这篇关于Numpy数组的长整数形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆