Hello again, this is a Freecodecamp challenge, this time getting some unexpected output.
I am in the step where need to normalize the data by making 0 always good and 1 always bad. If the value of cholesterol or gluc is 1, make the value 0. If the value is more than 1, make the value 1.
The output for gluc, that is gluc1, is working properly showing 0 or 1 accordingly, although with cholesterol is showing me the 1 correctly, but instead showing me 0s, is displaying Nans.
Have been working around it but cant get it done so far, please help
df.loc[df['gluc'] <= 1, 'gluc1'] = 0
df.loc[df['gluc'] > 1, 'gluc1'] = 1
df.loc[df['cholesterol'] <= 1, 'cholesterol'] = 0
df.loc[df['cholesterol'] > 1, 'cholesterol1'] = 1
print(df)
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 (Ecosia android@101.0.4951.41)