numpy matrix in python 3
np.matrix([[1, 2], [3, 4]])
# matrix([[1, 2],
# [3, 4]])
numpy matrix in python 3
np.matrix([[1, 2], [3, 4]])
# matrix([[1, 2],
# [3, 4]])
numpy generate random 2d array
import numpy as np
a=np.random.rand(3,3)
print(a)
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)
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])
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us