Skip to content
Advertisement

Numpy Zero Padding to match a certain shape

I have a file with arrays or different shapes. I want to zeropad all the array to match the largest shape. The largest shape is (93,13).

To test this I have the following code:

JavaScript

how can I zero pad this array to match the shape of (93,13)? And ultimately, how can I do it for thousands of rows?

Edit: The solution was found in the comments:

JavaScript

Advertisement

Answer

You could do like this. array is your original array and in this case just for testcase. Just use your own one.

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