flatten a 2d array python

arr_2d = [[1, 2, 3], [4, 5, 6]]
arr_1d = [el for arr in arr_2d for el in arr]
print(arr_1d) # [1, 2, 3, 4, 5, 6]

Here is what the above code is Doing:
1. We have a 2D array, arr_2d.
2. We create a new list, arr_1d.
3. We iterate over each element in arr_2d.
4. For each element, we iterate over each element in that element.
5. We add each element to arr_1d.
6. We print arr_1d.