Skip to content

Instantly share code, notes, and snippets.

@IvanNardini
Last active August 1, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanNardini/72cd5d2c96464e1f2ec4179b5104b1d3 to your computer and use it in GitHub Desktop.
Save IvanNardini/72cd5d2c96464e1f2ec4179b5104b1d3 to your computer and use it in GitHub Desktop.
Back to the Machine Learning fundamentals: How to write code for Model deployment (Part 3/3)
def encoder(data, var, mapping):
'''
Encode all variables for training
:params: data, var, mapping
:return: DataFrame
'''
if var not in data.columns.values.tolist():
pass
return data[var].map(mapping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment