import seaborn df = seaborn.load_dataset("titanic") df.age.fillna(value=-1, inplace=True) print(df.head()) print(df.age.isnull().mean()*100)
The output of the above program will be:
survived pclass sex age ... deck embark_town alive alone 0 0 3 male 22.0 ... NaN Southampton no False 1 1 1 female 38.0 ... C Cherbourg yes False 2 1 3 female 26.0 ... NaN Southampton yes True 3 1 1 female 35.0 ... C Southampton yes False 4 0 3 male 35.0 ... NaN Southampton no True [5 rows x 15 columns] 0.0
As we can see, after the arbitrary value imputation in the age column of the dataset, the age column does not have any missing values.






0 Comments