Some sklearn encoders don't accept many-columned 2D arrays.
Make example data
lzt_int = [1, 2, 3, 4, 5, 6]
d1_int = np.array(lzt_int)
d2_int_multi = d2_int.reshape(int(d2_int.shape[0]/3), 3)
A many columned 2D array
>>> d2_int_multi
array([[1, 2, 3],
[4, 5, 6]])
Want to efficiently turn into a 3D array of 2D single columns that looks like this.
array([
[[1],
[4]],
[[2],
[5]],
[[3],
[6]],
])
Transformation attempts
>>> d2_int_multi.reshape(3, 2, 1, order='C')
array([[[1],
[2]],
[[3],
[4]],
[[5],
[6]]])
>>> d2_int_multi.reshape(3, 2, 1, order='F')
array([[[1],
[5]],
[[4],
[3]],
[[2],
[6]]])
>>> d2_int_multi.reshape(3, 2, 1, order='A')
array([[[1],
[2]],
[[3],
[4]],
[[5],
[6]]])
For the sake of memory - I'd prefer not to access each column, make it a 2D array, before adding it to a 3D array.