Resolved: Dummy variable not converting to Zero's and Ones
Please why am I getting boolean values of false and true instead of zeros and ones
Hi Nike!
Thanks for reaching out.
Can you please check the contents of the 'Reason for Absence' column prior to applying the .get_dummies()
method? It seems that there's the key to this outcome.
Hope this helps but please feel free to get back to us should you need further assistance. Thank you!
Kind regards,
Martin
Hi Martin, these were the steps I followed in line with the lectures before get_dummies, can you help identify the issue
And then after the error above, i get
so what caused the error above, yet reason_columns gave an output?
Hi Nike,
try the code below in order to get 0 and 1 instead of True and False
reason_columns = pd.get_dummies(df['Reason for Absence'] ,dtype=int)
Hi Jawad,
Thanks, it worked.
Hi Nike and jawad!
@jawad: Thank you very much for providing a solution.
Kind regards,
Martin