1. 程式人生 > >python3-樣本亂序重排

python3-樣本亂序重排

numpy print shuffle nump odin reat arr shu pre

#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 8 12:33:34 2019 @author: myhaspl """ import numpy as np xx=np.array([10,20,30,40,50,60]) cc=np.arange(6) np.random.shuffle(cc) print(xx) print(cc) xx=xx[cc] print(xx)

[10 20 30 40 50 60]
[4 2 3 5 0 1]
[50 30 40 60 10 20]

python3-樣本亂序重排