I have a dataset loaded by dataframe where the class label needs to be encoded using LabelEncoder
from scikit-learn. The column label
is the class label column which has the following classes:
[‘Standing’, ‘Walking’, ‘Running’, ‘null’]
To perform label encoding, I tried the following but it does not work. How can I fix it?
from sklearn import preprocessing
import pandas as pd
df = pd.read_csv('dataset.csv', sep=',')
df.apply(preprocessing.LabelEncoder().fit_transform(df['label']))