use*_*991 13 python arrays numpy
我正在尝试numpy数组的功能,下面是代码:
import numpy as np
Z =np.array(
[[0,4,0,0,0,0],
[0,0,0,1,0,0],
[0,1,0,1,0,0],
[0,0,1,1,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0]])
print Z
print Z.dtype
print Z.shape
Run Code Online (Sandbox Code Playgroud)
这给了:
[[0 4 0 0 0 0]
[0 0 0 1 0 0]
[0 1 0 1 0 0]
[0 0 1 1 0 0]
[0 0 0 0 0 0]
[0 0 0 0 0 0]]
int32
(6L, 6L)
Run Code Online (Sandbox Code Playgroud)
它是一个包含6行和6列的整数数组.但是numpy.hape中的32和numpy.shape中的L是什么?
在我的机器上它给出(6, 6),L在你的机器上将它标记为长整型。
IE
In [133]: type(123L) is long
Out[133]: True
Run Code Online (Sandbox Code Playgroud)