小编plg*_*ent的帖子

“没有 [Int64Index , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\n ...... dtype='int64 ')] 在 [列] 中”

我目前正在尝试对 pandas 数据框执行 KFold,从 csv 读取 pandas 文件。不幸的是我收到错误:

“没有 [Int64Index , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\n ...... dtype='int64 ')] 在 [列] 中”

这是我的代码:

def getSlicesOfData(read_csv):
    slice_training_data = read_csv[["player", "0", "1", "2", "3", "4", "5", "6", "7", "8"]]
    slice_prediction_data = read_csv[["best_move"]]
    return (slice_training_data, slice_prediction_data)

def getKFold(data_sliced):
    kf = KFold(n_splits=10, random_state=None, shuffle=False)
    return kf.split(data_sliced[0],data_sliced[1])
    #return TimeSeriesSplit(n_splits=10, max_train_size=9)

if __name__ == "__main__":
    read_csv = pd.read_csv('100games.csv')
    data_slice = getSlicesOfData(read_csv)
    for train_index, test_index in …
Run Code Online (Sandbox Code Playgroud)

dataframe pandas scikit-learn

4
推荐指数
2
解决办法
7447
查看次数

标签 统计

dataframe ×1

pandas ×1

scikit-learn ×1