Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save audhiaprilliant/3dea3cdc1266d210fe51a448882cc0fa to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/3dea3cdc1266d210fe51a448882cc0fa to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
# One hot encoder
# Add new column of Loan_Status with 999 in testing data
df_test['Loan_Status'] = 999
# Concat the training and testing data
df_concat = pd.concat(objs = [df_train , df_test], axis = 0)
# Drop the column of Loan_ID
df_concat.drop(columns = ['Loan_ID'], inplace = True)
# Categorical columns
cols_obj_train = ['Gender', 'Married', 'Dependents', 'Education', 'Self_Employed', 'Credit_History', 'Property_Area']
# One-hot encoding
df_concat = pd.get_dummies(data = df_concat, columns = cols_obj_train, drop_first = True)
print('Dimension data: {} rows and {} columns'.format(len(df_concat), len(df_concat.columns)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment