简体   繁体   中英

Python: Subarrays into One Array -> Numpy

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

I am trying to convert these subarrays to one array using numpy.

Normally you have just to reshape if your vector is already a numpy array. So if your vector has a dimension (3,1) like in your example:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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