bool_os = laptops["os"]=="No OS"
laptops[bool_os]["os_version"] = "Version Unknown" #method 1
laptops.loc[bool_os, "os_version"] = "Version Unknown" #method 2
I’ve tried to assign values using those two methods.
Why doesn’t the first one work as both references gives the same series?
Hello @MichaLewsza,
Welcome to the community! I believe both methods should give you the same series.
What do you mean by the first one doesn’t work?
You can also include a link to the course page.
Hello @doyinsolamiolaoye,
What I mean is that the first method leaves the dataframe without any changes.
Only second method assigns string: “Version Unkown” to the specified places in dataframe.
Here’s the link to the course page: https://app.dataquest.io/m/293/data-cleaning-basics/11/filling-missing-values
Thanks for your reply!
@DishinGoyani thank you a lot!