<分区>
我正在尝试操作从 Sci-Kit Learn 的 train_test_split 操作中收到的数据帧。系统给了我以下信息:
/usr/local/lib/python3.6/site-packages/pandas/core/indexing.py:179: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
以下会在我的系统上引发警告:
import pandas as pd
from sklearn.model_selection import train_test_split
X=pd.DataFrame({'A':[2,5,7,8,9],'B':[2,5,3,51,5]})
(Xt,Xv)=train_test_split(X)
Xt.iloc[0,0]=6
我使用以下版本:
python: '3.6.1(默认,2017 年 6 月 26 日,19:29:26)\n[GCC 4.9.2]'
Pandas :0.20.3
sklearn: 0.18.2