import seaborn from matplotlib import pyplot df = seaborn.load_dataset("titanic") most_frequent_value = df["embark_town"].mode() print("Mode: ", most_frequent_value) df.embark_town.fillna(value=”Southampton”, inplace=True) print(df.embark_town.isnull().mean()*100)
Here, we are using the fillna() function to fill the missing values with “Southampton.” Now, the percentage of missing values in the embark town column is zero.
Mode: 0 Southampton Name: embark_town, dtype: object 0.0






0 Comments