How does panda know which column to fill with the mean?

Hi guys!
Silly question but how does panda know which column to fill with the mean.
In this mission:

We need to fill missing values with their mean.
The task is simple, but just confuse how it knows which column to map to.

Below is my code:

combined = combined.fillna(means)

Thanks,
Shanil

Hi! It’s not a silly question :slight_smile: You are filling in all missing values for the whole DataFrame here.
If you want indicate which column to fill in you’ll need to use Series.fillna(), eg. combined["sat_score"].fillna(). I hope this helped :slight_smile:

I see, thanks for answering my question! :slightly_smiling_face:

1 Like