for train_index, test_index in sss: xtrain, xtest = data.iloc[train_index], data.iloc[test_index] ytrain, ytest = target[train_index], target[test_index]我倾向于第二种方法,因为它给出类型为DataFrame的xtrain和xtest而不是ndarray,因此保留列标签.I tend to favour the second approach, since it gives xtrain and xtest of type DataFrame rather than ndarray, and so keeps the column labels. 这篇关于sklearn.cross_validation.StratifiedShuffleSplit-错误:“索引超出范围";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-26 20:02