text_plain_output_1.png
import pandas as pd

wp = pd.read_csv('https://raw.githubusercontent.com/kunal-mallick/Kaggle-Project/Working/Water%20Quality(Drinking%20Water%20Potability)/src/main/resources/water_potability.csv')
wp

wp_nrow = wp.shape[0]

def lost_record():
    wp_nrow_now = wp.shape[0]
    lost = wp_nrow - wp_nrow_now
    lost = lost / wp_nrow * 100
    lost = round(lost, 2)
    return

def missing_percentage(wp):
    m = wp.isna().sum()
    total = int(wp.shape[0])
    for i in range(len(wp.columns)):
        percentage = round(m[i] / total * 100)

wp.fillna(value={'ph': wp['ph'].median(), 'Sulfate': wp['Sulfate'].median(), 'Trihalomethanes': wp['Trihalomethanes'].median()}, inplace=True)

missing_percentage(wp)