Created
August 11, 2022 06:06
-
-
Save charanhu/5867a54623da528bd4acdca6d4a35b36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding sex column | |
insurance_dataset.replace({'sex':{'male':0, 'female':1}}, inplace=True) | |
# encoding smoker column | |
insurance_dataset.replace({'smoker':{'yes':0, 'no':1}}, inplace=True) | |
# encoding region column | |
insurance_dataset.replace({'region':{'southeast':0, 'southwest':1, 'northeast':2, 'northwest':3}}, inplace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment