I have a list of arrays with each array shape (2, 2). I want to "divide" them by rows so that each row is added to a new list of (1, 2).
Example:
X = np.random.rand(2, 2)
Y = np.random.rand(2, 2)
li = [X, Y]
li
[array([[0.06959048, 0.14011019],
[0.8171005 , 0.31335564]]),
array([[0.94952885, 0.15987638],
[0.8033848 , 0.56760287]])]
I want this result:
new_li
[array([0.06959048, 0.14011019]),
array([0.8171005 , 0.31335564]),
array([0.94952885, 0.15987638]),
array([0.8033848 , 0.56760287])]
I know that extend for each variables will do the desired result, e.g.:
li.extend(X)
li.extend(Y)
But I have a pre-existing list.