Skip to content

Instantly share code, notes, and snippets.

@IvanNardini

IvanNardini/encoder.py

Last active Aug 1, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.