Answers for "numpy 2d array"

3

numpy matrix in python 3

np.matrix([[1, 2], [3, 4]])

# matrix([[1, 2],
#         [3, 4]])
Posted by: Guest on September-27-2020
1

numpy generate random 2d array

import numpy as np
a=np.random.rand(3,3)
print(a)
Posted by: Guest on November-07-2020
-1

numpy make 2d array 1d

import numpy as np
  
ini_array1 = np.array([[1, 2, 3], [2, 4, 5], [1, 2, 3]])
  
# printing initial arrays
print("initial array", str(ini_array1))
  
# Multiplying arrays
result = ini_array1.flatten()
  
# printing result
print("New resulting array: ", result)
Posted by: Guest on July-24-2021
-1

python 2d array

array = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]

print(array[0])

print(array[1][2])
Posted by: Guest on September-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language