Pandasdrill

Level 2: Cleaning Exercise 10 of 45 Pro

Fill missing values in one column

A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.

The task

Some players have no `points` recorded. Replace the missing points with 0, leave the missing `assists` as they are, and return the whole `scores` table.

What this exercise teaches

fillna on a single column touches only that column. Calling fillna on the whole DataFrame would also turn the missing assists into 0, which changes data you were asked to keep. A dict like {"points": 0} does the same job in one call.

A hint if you get stuck

Call fillna on the points column only, then put it back into the table.

This exercise is part of Pro

Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.

You create a free account first, so Pro is attached to it.

Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.

Start with the free exercises

More exercises in Cleaning