O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filling using index labels

Data can be filled using the labels of a Series or keys of a Python dictionary. This allows you to specify different fill values for different elements, based upon the value of the index label:

Only values of NaN are filled. Note that the values with label a are not changed.

Another common scenario is to fill all the NaN values in a column with the mean of the column:

This is convenient, as missing values replaced in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required