Answers for "how to initialize a numpy matrix"

1

python initialize matrix

# Declaring rows
N = 5
  
# Declaring columns
M = 4
  
# using list comprehension 
# to initializing matrix
res = [ [ 0 for i in range(M) ] for j in range(N) ]
Posted by: Guest on June-28-2021
-1

initialize np array

an_array = np.empty((2, 2))
Posted by: Guest on May-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language