0

I want to create a array of arrays using numpy.full, but i get a error if I set the fill to [1, 1, 1, 1]. Doing the lines below gives this error

size = (20, 20)
npArray = np.full(size, [1, 1, 1, 1])    
ValueError: could not broadcast input array from shape (4) into shape (20,20)

Should I just use python like so

list = [[[1, 1, 1, 1] for y in range(size[1])] for x in range(size[0])]
adammoyle
  • 199
  • 1
  • 13

0 Answers0