Ibrahim EL MEREHBI
2016-03-23 13:06:44 UTC
Hello,
I have a multi-diensional array that I would like to split its columns.
For example consider,
dat = np.array([np.arange(10),np.arange(10,20), np.arange(20,30)]).T
array([[ 0, 10, 20],
[ 1, 11, 21],
[ 2, 12, 22],
[ 3, 13, 23],
[ 4, 14, 24],
[ 5, 15, 25],
[ 6, 16, 26],
[ 7, 17, 27],
[ 8, 18, 28],
[ 9, 19, 29]])
I already can split one column at a time:
np.array_split(dat[:,0], [2,5,8])
[array([0, 1]), array([2, 3, 4]), array([5, 6, 7]), array([8, 9])]
How can I extend this for all columns and (overwrite or) have a new
multi-dimensional array?
Thank you,
Bob
I have a multi-diensional array that I would like to split its columns.
For example consider,
dat = np.array([np.arange(10),np.arange(10,20), np.arange(20,30)]).T
array([[ 0, 10, 20],
[ 1, 11, 21],
[ 2, 12, 22],
[ 3, 13, 23],
[ 4, 14, 24],
[ 5, 15, 25],
[ 6, 16, 26],
[ 7, 17, 27],
[ 8, 18, 28],
[ 9, 19, 29]])
I already can split one column at a time:
np.array_split(dat[:,0], [2,5,8])
[array([0, 1]), array([2, 3, 4]), array([5, 6, 7]), array([8, 9])]
How can I extend this for all columns and (overwrite or) have a new
multi-dimensional array?
Thank you,
Bob