I have a dataframe which I'm trying to replace all NaN's with the word "Unknown".
I tried using the following code:
reviews[reviews.country.fillna("Unknown")]
This does not work.
What will work, is the code below which to my knowledge creates a series:
reviews.country.fillna("Unknown")
But, my question is why can I not create a dataframe with the fillna function; for some reason, I cannot apply "reviews[]" around the entire code?
Why will fillna only work for a series?
To make things even more confusing for me, I can make a dataframe with the isnull() function:
reviews[reviews.country.isnull()]
As you can see, here I can apply "reviews[]" around the entire code.
Why won't fillna not handle the same?
Can anyone explain to me the concept of what's happening?