Created
March 16, 2020 10:00
-
-
Save aniruddha27/c9a06afa42c22a1fc40ee1f7a625f4af 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
#NA means no masonary work | |
train['MasVnrType'].fillna('None',inplace=True) | |
#If no masonary work, then area is 0 | |
train['MasVnrArea'].fillna(0,inplace=True) | |
#Replace with the most common value | |
for i in ['MSZoning','Utilities']: | |
train[i].fillna(train[i].mode()[0],inplace=True) | |
#"Assume typical unless deductions are warranted" | |
train['Functional'].fillna('Typ',inplace=True) | |
#Replace with others | |
train['SaleType'].fillna('Oth',inplace=True) | |
#Replace with most common value | |
train['Electrical'].fillna(train['Electrical'].mode()[0],inplace=True) | |
#Replace with 'Other' value | |
for i in ['Exterior1st','Exterior2nd']: | |
train[i].fillna('Other',inplace=True) | |
#Replace with most common value | |
train['KitchenQual'].fillna(train['KitchenQual'].mode()[0],inplace=True) | |
#ordinal value | |
train['KitchenQual'].replace(['Ex','Gd','TA','Fa','Po'],[4,3,2,1,0],inplace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment