df.apply(lambda x: x == ' ', axis = 1).mean() df.loc[df.TotalCharges == ' ', :] df.loc[df.TotalCharges == ' ', 'TotalCharges'] = 0
df.apply(lambda x: x == ' ', axis = 1).mean() df.loc[df.TotalCharges == ' ', :] df.loc[df.TotalCharges == ' ', 'TotalCharges'] = 0