Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Missing values
4. Filling NaN values
Duplicate rows
Joining datasets


Good job. You could see that NaN values were put at the very end when we applied sorting. The same would happen if we were to sort the values in descending order.

Imagine we go to the author of the dataset and ask about those missing values. Apparently, in thix context, a missing value means that a given employee did not resolve a single ticket the last month.

In this case, it would make more sense to put zeroes instead of NaNs. We can use the following syntax to do so:

ticket_statistics = ticket_statistics.fillna(0)

The fillna(...) function turns NaN values into whatever is put inside its parentheses. Naturally, zero isn't the only possibility. Depending on the circumstances, NaN values can sometimes be replaced with the mean, mode, or median value of the entire column.


Modify your previous solution. Before sorting the values, turn all NaN values into zeroes.

As you can see, employees with no resolved tickets are now correctly placed at the beginning of the DataFrame.

Stuck? Here's a hint!

Use the following solution:

ticket_statistics = ticket_statistics.fillna(0)