Issue
I have a numpy array with shape (100,9,17,2). I need to transform it to (100,15,17,2) adding zeros in missing cells. I created a zeros(100,6,17,2) but I can't merge them. Can you help me?
Solution
Use numpy's concatenate function.
result = np.concatenate([input_array, np.zeros((100, 6, 17, 2), dtype=input_array.dtype)], axis=1)
The axis
argument is the argument over which you want the dimensions to be added.
Answered By - Jules G.M.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.