[英]KeyError: "['features'] not found in axis"
This is another error when I am trying to split the balanced dataset into training and test set by 80% and 20% using the KNN model in Python. What is meant by the error given below?这是另一个错误,当我尝试使用 Python 中的 KNN model 将平衡数据集分成 80% 和 20% 的训练和测试集时。下面给出的错误是什么意思?
y = ["TCGA.22.5482.LUSC.C1"]
x = Combined_data_df.drop(['features'],axis=1)
**KeyError** Traceback (most recent call last)
<ipython-input-68-9ee94240e101> in <module>
1 y = ["TCGA.22.5482.LUSC.C1"]
----> 2 x = Combined_data_df.drop(['features'],axis=1)
**KeyError: "['features'] not found in axis"**
What is meant by this error?这个错误是什么意思?
The error mean this ['features'] not founded as column into your dataset, I can not figure out what is your features and target you choose from your data set.该错误意味着此 ['features'] 未作为列创建到您的数据集中,我无法弄清楚您从数据集中选择的功能和目标是什么。 I can show you an example: A dataset it's column names id, qid1, qid2, ques1, ques2, is_duplicated so the right code to defined which features and target you want to predict
我可以给你看一个例子:一个数据集,它的列名是 id、qid1、qid2、ques1、ques2、is_duplicated 所以正确的代码可以定义你想要预测的特征和目标
features = ['qid1','qid2','question1','question2'] target = raw_df.drop(features,axis =1) features = ['qid1','qid2','question1','question2'] target = raw_df.drop(features,axis =1)
this code mean you choose some columns as feature, from your data delete these columns then rest of columns become target此代码意味着您选择一些列作为特征,从您的数据中删除这些列,然后 rest 列成为目标
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.