You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, numpy.random.shuffle only supports shuffling along the first axis only. Many other Numpy functions support the axis keyword argument to specify the axis along which the respective operation should be applied, it would be great to have such an argument for this function as well.
import numpy as np
a = np.arange(40).reshape((5,8))
# shuffle along axis 1
np.apply_along_axis(np.random.shuffle,1,a)
# shuffle along axis 0
np.random.shuffle(a)
print(a)
Activity
subhrm commentedon Jul 20, 2018
I would suggest
apply_along_axis. PFB an example :Example output:
WarrenWeckesser commentedon Aug 13, 2019
FYI: #5173
wkschwartz commentedon Oct 8, 2019
Can this be closed now because of #13829?
CyanoKobalamyne commentedon Oct 8, 2019
I believe so. Thank you!