Python-pandas Passing list-likes to .loc or [] with any missing labels is no longer supported

Python-pandas Passing list-likes to .loc or [] with any missing labels is no longer supported 问题的解决

在对某个数据集进行
pd.DataFrame(y_train).loc[train_index]
函数运算时,出现标题所显示错误。
查阅官网文档等资料后,解决办法为:

pd.DataFrame(y_train).loc[y_train.index.intersection(train_index)]

你可能感兴趣的:(python,机器学习,pandas,python)