Skip to content Skip to sidebar Skip to footer

Python - Numpy Array_split Adds A Dminesion

I am trying to split a data set into 3 parts and I am having issues because the matrices are not getting the dimensions I wish. First of all, I know this method is ridiculously ina

Solution 1:

The problem is in the shuffle:

In [661]: data = np.arange(12).reshape(3,4)
In [662]: np.random.shuffle(data)
In [663]: data[np.random.shuffle(data)].shape
Out[663]: (1, 3, 4)

shuffle operates in place, and returns None.

data[None]

adds a new dimension at the start. So split gets a (1,283034,31) which it splits 3 ways on axis=1 (as instructed).


Post a Comment for "Python - Numpy Array_split Adds A Dminesion"