Hi
I want to know how can I convert a particular column of pandas data frame into it’s binary values using LabelEncoder (from sklearn.preprocessing import LabelEncoder).
I opened Train data set as a pandas data frame, for my model the ‘label’/output values should be in binary(0&1). So I sliced label column from pandas data frame as k=df_train.loc[:,‘label’], where k is the whole pandas data frame of Train data. And then I tried doing :
from sklearn.preprocessing import LabelEncoder
le=LabelEncoder()
output=k.apply(le.fit_transform)
but it gave me a value error, I tried figuring this out but I’m unable to convert label column to binary by extracting label column from pandas data frame. Please help me out.
Thank You