In [1]:
from sklearn.datasets import load_iris
import numpy as np
# load
data = load_iris()
x = data['data']
In [2]:
# 从样本中抽取10
no_records = 10
x_sample_index = np.random.choice(range(x.shape[0]),no_records)
print x_sample_index
In [3]:
print x[x_sample_index,:]