[Solved] python2.7 create array in loop [closed]


After 4 days of trying I found the answer myself. Thanks for the great help guys…

import numpy
DARK = []
a = []
stack = []
for i in range(0,3):
    # create 3d numpy array
    d = numpy.array([[1, 2], [3, 4]])
    a.append(d)
    stack.append(numpy.array(a))
    # write it into the actual variable
    DARK.append(numpy.array(numpy.median(stack[i], 0)))

solved python2.7 create array in loop [closed]