numpy附加2D数组
假设我有一堆2D数组形状(32,32)
我想与较大的3D阵列分开。
我不知道有多少个2D阵列,所以必须附加它们。
我尝试过堆叠,但这仅适用于前两个阵列。
我想要的是拥有一大批形状(0,32,32)
,当我附加时,第一个2D数组将变成(1,32,32)
然后(2,32,32)
,但到目前为止对我来说还没有任何作用。
Let's say I have a bunch of 2d arrays shape (32,32)
that I want to be apart of a larger 3d array.
I don't know how many 2d arrays there are so they must be appended.
I've tried stacking but that only works for the first 2 arrays.
What I want is to have a big array of shape (0, 32, 32)
that when I append the first 2d array will become (1, 32, 32)
then (2, 32, 32)
but so far nothing has worked for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将2D数组重塑为3D数组,并在轴0中具有一个维度:
You can try reshaping the 2d arrays into 3d arrays with one dimension in the axis 0: