我有两个数组,一个是(array A[10][10000]
):
1: [[ 0 0 0 ..., 156 665 621]
2: [ 0 0 0 ..., -187 -186 -186]
3: [ 0 0 0 ..., 61 -22 -55]
...,
8: [ 0 0 0 ..., 540 402 496]
9: [ 0 0 0 ..., 31 31 33]
10: [ 0 0 0 ..., -525 -504 -492]]
长度为10*10000
,类型为<type 'numpy.ndarray'>
,dtype 为int16
另一个是(array B[10]
):b=numpy.arange(10)
[ 0 1 2 ..., 7 8 9]
长度是10
,类型是<type 'numpy.ndarray'>
, dtype 是int32
我希望将这两个不同维度的数组转换为这样的一个元组(tuple C
):
(array([[ 0, 0, 0, ..., 156, 665, 621],
[ 0, 0, 0, ..., -187, -186, 0],
[ 0, 0, 0, ..., 61, -22, -55],
...,
[ 0, 0, 0, ..., 540, 402, 496],
[ 0, 0, 0, ..., 31, 31, 33],
[ 0, 0, 0, ..., -525, -504, -492]], dtype=int16),
array( [ 0, 1, 2, ..., 7, 8, 9], dtype=int32))
有关元组 C 的更多信息:
print A[0].shape = (10, 10000)
print A[0].dtype.name = int16
print type(A[0]) = <type 'numpy.ndarray'>
print A[1].shape = (10,)
print A[1].dtype.name = int32
print type(A[1]) = <type 'numpy.ndarray'>