I have a numpy array Z1, Z2, Z3:
Z1 = [1,2,3]
Z2 = [4,5]
Z3 = [6,7,8,9]
I want new numpy array Z that have Z1, Z2, Z3 as array like:
Z = [[1,2,3],[4,5],[6,7,8,9]
print(type(Z),type(Z[0]))
>>> <class 'numpy.ndarray'> <class 'numpy.ndarray'>
I used np.append, hstack, vstack, insert, concatenate ...but all I failed.
There is only 2 case:
Z = [1,2,3,4,5,6,7,8,9]
or ERROR
so I made a list Z first, and append list Z1, Z2, Z3 and then convert list Z into numpy array Z.
BUT
Z = [[1,2,3],[4,5],[6,7,8,9]]
print(type(Z),type(Z[0]))
>>> <class 'numpy.ndarray'> <class 'list'>
I want to do not use 'while' or 'for'. Help me please..
z = np.array([Z1, Z2, Z3])