You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
# use a label encoder on columns with string data and store the output in a new dataframe
le = LabelEncoder()
for col in df:
if df[col].dtype == 'object': # if column datatype is object (string) then convert to categorical values (numbers) and store in new dataframe called df_new
df[col] = le.fit_transform(df[col]) # fit and transform the column values with label encoder and store in same dataframe