Skip to content

Instantly share code, notes, and snippets.

@analyticsindiamagazine
Created November 26, 2019 08:48
Show Gist options
  • Save analyticsindiamagazine/04ab6af70a518f4e5695301e929284be to your computer and use it in GitHub Desktop.
Save analyticsindiamagazine/04ab6af70a518f4e5695301e929284be to your computer and use it in GitHub Desktop.
#Filling Nulls/Nans
train.fillna('NAN', inplace = True)
#Label Encoding
from sklearn.preprocessing import LabelEncoder
le_c = LabelEncoder().fit(unique_cuisines)
train['Cuisines'] = le_l.transform(train['Cuisines'])
#Scaling
cols = [list of columns to apply standard scaler]
from sklearn.preprocessing import StandardScaler
ss = StandardScaler()
train[cols] = ss.fit_transform(train_sample[cols])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment