Answers for "generate 2d array numpy"

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

Python Answers by Framework

Browse Popular Code Answers by Language