zeropad all the arrays to match the largest array in that file in python

0 votes
I have a file of arrays with different shapes. I want to zeropad all the arrays to match the largest array in that file. How do I do that?
May 29 in Python by anonymous
17 views

1 answer to this question.

0 votes

You can try something like this:

import numpy as np
array  = [[None] * 10]*10
#print(array)
testarray = np.zeros((93,13))
for index,row in enumerate(array):
    for i in range(0,len(row)-1):
        testarray[index][i]= row[i]
answered May 29 by Wazeer

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Is arr.__len__() the preferred way to get the length of an array in Python?

my_list = [1,2,3,4,5,6,7] len(my_list) # 7 The same works for ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,180 points
73 views
0 votes
1 answer

Is it possible to create an array with all values as zero in python?

You can use  np.zeros(4,3) This will create a 4 ...READ MORE

answered May 24 in Python by Anjali
55 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 337 views
+4 votes
6 answers
0 votes
1 answer