[英]python numpy convert two diffrent dimension arrays to one tuple
I got two arrays, the one is( array A[10][10000]
): 我有两个数组,一个是( 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]]
length is 10*10000
,type is <type 'numpy.ndarray'>
,and dtype is int16
长度为10*10000
,类型为<type 'numpy.ndarray'>
,并且int16
为int16
anothor one is( array B[10]
) : b=numpy.arange(10)
另一个是( array B[10]
): b=numpy.arange(10)
[ 0 1 2 ..., 7 8 9]
length is 10
, type is <type 'numpy.ndarray'>
, and dtype is int32
长度是10
,类型是<type 'numpy.ndarray'>
,而<type 'numpy.ndarray'>
是int32
and I wish to convert this two different dimension arrays to one tuple like this( tuple C
): 我希望将这两个不同维度数组转换为一个像这样的tuple C
( 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))
more information about tuple C: 有关元组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'>
除非我缺少任何东西,否则您只想要一个将两个数组作为元素的元组:
C = (A, B)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.