Please help me understand why this syntax is not working
data[data.country == 'SA'].postal_code.fillna(data[data.country == 'SA'].postal_code.mode(), inplace=True)
Basically what I want to do is fillna()
the postal_code
column with the most frequent postal code where the country is equivalent to SA. When I run the above code I don't get an error, however when I run data[data.postal_code.isnull()]
I still get NaN
's in the postal code column where country == 'SA'