Issue
I have this problem where I would prefer not using loops because I am working with a big data as a solution :
This is what I am trying to do : (I know this works to [6 6 6], but I want to "join" it by index)
import numpy as np
np_1 = np.asarray([1,1,1])
np_2 = np.asarray([2,2,2])
np_3 = np.asarray([3,3,3])
np_4 = np_1 + np_2 + np_3
# np_4 should be [1,2,3,1,2,3,1,2,3]
Are there ways to do this? or should I look for options outside of numpy?
Solution
Try this:
np.array([np_1, np_2, np_3]).transpose().flatten()
Answered By - Ralph Tandetzky
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.