Quick question:
I have a flat array array = [1,2,3,4,5,6,7,8,9]
What’s the best way to make it into a 2dim array divided into thirds?
[[1,2,3],[4,5,6],[7,8,9]]
if you have a numpy array, you could just say
a.shape = (3,3)
Without numpy, try this:
[a[i:i+3] for i in range(0,9,3)]