Skip to content
Advertisement

Merge numpy arrays with different dimensions

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?

Advertisement

Answer

Use numpy’s concatenate function.

JavaScript

The axis argument is the argument over which you want the dimensions to be added.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement