简体   繁体   English

如何在 python 中将 (5858, ) 的形状更改为 (5858, n)

[英]How to change shape of (5858, ) to (5858, n) in python

I want to concatenate two numpy files, but they have different shape and style.我想连接两个 numpy 文件,但它们的形状和样式不同。 The first file '640_lbp.npy', consist of list, but the second one 'train_x_test.npy' consist of array.第一个文件“640_lbp.npy”由列表组成,但第二个文件“train_x_test.npy”由数组组成。

I got a numpy file with the shape of (5858,), now I want to change it to (5858, n), where n represent length of each row.我得到了一个 numpy 文件,形状为 (5858,),现在我想将其更改为 (5858, n),其中 n 代表每行的长度。 How can I do that.我怎样才能做到这一点。

enter image description here在此处输入图像描述

enter image description here在此处输入图像描述

That will not work.那不管用。 Arrays have to be rectangular, and therefore cannot have different shapes depending on which row you are in. Arrays 必须是矩形的,因此不能有不同的形状,具体取决于您所在的行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM