Created
July 2, 2017 11:46
-
-
Save mzaradzki/4cb32631240c900bcdb8f84922841e94 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
# before filling the null keep track of them | |
dfX['construction_year_missing'] = (dfX['construction_year']==0)*1 | |
dates.append( 'construction_year_missing' ) # list of dates related fields | |
# to fill missing dates, can use : mean, median or oldest | |
mean_year = dfX[dfX['construction_year']>0]['construction_year'].mean() | |
dfX.loc[dfX['construction_year']==0, 'construction_year'] = int(mean_year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment