I've got
Xa = [a1,a2,a3]
Xb = [b1,b2,b3]
Xc = [c1,b2,b3]
And I want
X = [[a1,a2,a3],[b1,b2,b3],[c1,b2,b3]]
Im using numpy append, concatenate, hstack, vstack, and others functions, but them doesnt work or gives me this
X = [a1,a2,a3,b1,b2,b3,c1,b2,b3]
Also after this process I will need to append Xd, Xe, Xf and so on, so I need a way to add these vectors to the array as they come.
Any ideas on what Im doing wrong or what to do?
It's pretty simple if just simple array. initialize an empty array and keep appending your arrays to it.
Xa = ['a1','a2','a3']
Xb = ['b1','b2','b3']
Xc = ['c1','b2','b3']
Empty array
resultArray = []
resultArray.append(Xa)
resultArray.append(Xb)
resultArray.append(Xc)
output:
[['a1','a2','a3'], ['b1','b2','b3'], ['c1','b2','b3']]
Hope this helps
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With