[- - - ]data labeling we discussed the importance of good fata for ml algorithms as well as some techniques to pre-process the data before sending it to ml algorithms one more aspect in this regard is data labeling it is also very important to send the data to ml algorithms having proper labeling for examplein case of classification problemslot of labels in the form of wordsnumbers etc are there on the data what is label encodingmost of the sklearn functions expect that the data with number labels rather than word labels hencewe need to convert such labels into number labels this process is called label encoding we can perform label encoding of data with the help of labelencoder(function of scikit-learn python library example in the following examplepython script will perform the label encoding firstimport the required python libraries as followsimport numpy as np from sklearn import preprocessing nowwe need to provide the input labels as followsinput_labels ['red','black','red','green','black','yellow','white'the next line of code will create the label encoder and train it encoder preprocessing labelencoder(encoder fit(input_labelsthe next lines of script will check the performance by encoding the random ordered listtest_labels ['green','red','black'encoded_values encoder transform(test_labelsprint("\nlabels ="test_labelsprint("encoded values ="list(encoded_values)encoded_values [ , , , decoded_list encoder inverse_transform(encoded_valueswe can get the list of encoded values with the help of following python script