【发布时间】:2017-09-21 08:04:33
【问题描述】:
我使用以下函数对我的数据集的分类特征进行编码(它有 27 个特征,其中 11 个是分类特征):
from sklearn import preprocessing
def features_encoding(data):
columnsToEncode = list(data.select_dtypes(include=['category', 'object']))
le = preprocessing.LabelEncoder()
for feature in columnsToEncode:
try:
data[feature] = le.fit_transform(data[feature])
except:
continue
return data
但我收到此错误:
FutureWarning: numpy not_equal will not check object identity in the future. The comparison did not return the same result as suggested by the identity (`is`)) and will change.
flag = np.concatenate(([True], aux[1:] != aux[:-1]))
我不明白这个错误。请问,有人可以解释它是什么以及如何解决它吗?
【问题讨论】:
标签: pandas numpy scikit-learn feature-extraction