Replace housing.loc[train_index] with housing.iloc[train_index]
parent
b2103e953a
commit
2855982461
|
@ -835,8 +835,8 @@
|
|||
"splitter = StratifiedShuffleSplit(n_splits=10, test_size=0.2, random_state=42)\n",
|
||||
"strat_splits = []\n",
|
||||
"for train_index, test_index in splitter.split(housing, housing[\"income_cat\"]):\n",
|
||||
" strat_train_set_n = housing.loc[train_index]\n",
|
||||
" strat_test_set_n = housing.loc[test_index]\n",
|
||||
" strat_train_set_n = housing.iloc[train_index]\n",
|
||||
" strat_test_set_n = housing.iloc[test_index]\n",
|
||||
" strat_splits.append([strat_train_set_n, strat_test_set_n])"
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue