简体   繁体   English

Python:子阵列成一个阵列-> Numpy

[英]Python: Subarrays into One Array -> Numpy

[[32794.211244][32570.179709][32710.191036]] -> [32794.211244, 32570.179709, 32710.191036] [[32794.211244][32570.179709][32710.191036]] -> [32794.211244, 32570.179709, 32710.191036]

I am trying to convert these subarrays to one array using numpy.我正在尝试使用 numpy 将这些子数组转换为一个数组。

Normally you have just to reshape if your vector is already a numpy array.通常,如果您的向量已经是 numpy 数组,您只需重新整形。 So if your vector has a dimension (3,1) like in your example:因此,如果您的向量具有像您的示例中那样的维度 (3,1):

t = [[32794.211244],[32570.179709],[32710.191036]]
np.reshape(t, (3,))

give you:
array([32794.211244, 32570.179709, 32710.191036])

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

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