问题:
如何将以下numpy数组的列表重塑/转换为所需的输出?我很想知道它是如何工作的,所以一个循序渐进的指南将非常感谢,因为我将不得不与混合工作数字阵列/列出案例。在
最小示例import numpy as np
# create some dummy data
points1 = np.array([[1, 2, 3],[101, 102, 103]])
points2 = np.array([[4, 5, 6, 7, 8],[104, 105, 106, 107, 108]])
points3 = np.array([[9, 10, 11, 12],[109, 110, 111, 112]])
# gather data / this kind of list is what I will have to work with
points = [points1, points2, points3]
# what it looks like now
print(points)
# do some fance reshape/rearrange stuff
# new_points = ???
# desired output:
# new_points[0] = [1, 101]
# new_points[1] = [2, 102]
# new_points[2] = [3, 103]
# ...
# new_points[11] = [12, 112]
我只能访问点(而不是points1等),它将是一个numpy数组的列表,这些数组都是成形的(2,n)。
有没有什么简短的,花哨的索引操作,或者我必须使用一个循环?在