Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
113 views
in Technique[技术] by (71.8m points)

python 3.x - I have a problem encoding the labels and storing them back into the array

for y in range(len(l1.columns)):
   for w in e1:
       from sklearn import preprocessing
       LE=preprocessing.LabelEncoder()
       LE.fit(w)
       X3[:,y]=LE.transform(X3[:,y])

where l1 is a dataframe consisting of only string datatype in it's columns and e1 is a list containing the labels as:[['F', 'M'], ['NORMAL', 'LOW', 'HIGH'], ['NORMAL', 'HIGH']] and X3 is an array in which I want the encoded values. In doing so.... I am getting the following error: ValueError: y contains previously unseen labels. Any help appreciated. Thank you.

question from:https://stackoverflow.com/questions/65599129/i-have-a-problem-encoding-the-labels-and-storing-them-back-into-the-array

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...