Search code examples
pandasfillna

Why is panda's fillna method not functioning?


I am working on this dataset and in one of the columns (LotFrontage) has 259 Nan values out of 1460. So when I use X.describe() it shows 259 nulls. I tried to fill those null values with 0's.. using isnull(). Once I view the result all the Nan values are correctly filled with zeros. But the problem is, when I run X.describe() again, it still shows 259 nan values. What am I doing wrong ? Any help please?


Solution

  • Pandas don't change the actual DataFrame. If you want to change in actual DataFrame you have to pass in-place argument as True

    <your_dataframe>.fillna(value = 0, inplace = True)