Answers for "python make 1d array from n-d array"

0

python make 1d array from n-d array

import numpy as np
a = np.array([[1, 2],
       [3, 4],
       [5, 6]])
a_flat = a.flatten()
print(f"original array: {a} \nflattened array = {a_flat}")
Posted by: Guest on July-07-2021

Python Answers by Framework

Browse Popular Code Answers by Language