initialize 2d numpy array code example
Example 1: python initialize a 2d array
x = [[foo for i in range(10)] for j in range(10)]
# x is now a 10x10 array of 'foo' (which can depend on i and j if you want)
Example 2: how to create multidimensional array in python using numpy
from numpy import *
array = array([[1,2,3,4],[3,4,2,5]])
## if want you can print it
print(array)
Example 3: initialise a 2d array python
x = [[foo for i in range(10)] for j in range(10)]
# x is now a 10x10 array of 'foo' (which can depend on i and j if you want)
Example 4: python initialize a 2d array
bar = [SOME EXPRESSION for item in some_iterable]