.fillna(), when is it appropriate?

When is it appropriate to use .fillna() instead of removing Nan values?

Hi, welcome to the forums.

I guess it depends on how you want to use your data. Personally, I wouldn’t use dropna().

In this case you’re just adding a “0” in that column, score rather than get rid of the entire row for that particular student. (Even though when calculating the .mean() NAs are ignored anyway.

To count the number of nulls in each col:


To count the total number of nulls in a df:

1 Like