Answers for "convert 2d np array to 1d"

1

convert 2d list to 1d python

import itertools

a = [[1, 2], [3, 4], [5, 6]]
list(itertools.chain.from_iterable(a))

Output:- [1, 2, 3, 4, 5, 6]
Posted by: Guest on August-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language