Since interpolate and fillna method does the same work of filling na values. What is the basic difference between the two. What is the significance of having these two different methods?? Can anyone explain me in layman terms. I already visited through the official documentation and wanted to know the difference


1 Answer 1


fillna fills the NaN values with a given number with which you want to substitute. It gives you an option to fill according to the index of rows of a pd.DataFrame or on the name of the columns in the form of a python dict.

But interpolate is a god in filling. It gives you the flexibility to fill the missing values with many kinds of interpolations between the values like linear (which fillna does not provide) in the example provided below and many more interpolations possible. For example

>> import pandas as pd, numpy as np
>> df = pd.Series([1, np.nan, np.nan, 3])
>> df.interpolate()
0    1.000000
1    1.666667
2    2.333333
3    3.000000
dtype: float64

Pandas documentation on fillna and interpolate is very clear on this.

  • $\begingroup$ Understood. Suppose if i want to fill only some specific values(may be in range or without range) that can also be done using interpolation. Right ? $\endgroup$
    – Debuggerrr
    Dec 23, 2017 at 17:23
  • $\begingroup$ Is it filling in with specific values or filling specific values as in cells of a DataFrame? $\endgroup$ Dec 24, 2017 at 0:30
  • $\begingroup$ filling specific values in cell at some particular locations only but at a time many values should be filled or in some range $\endgroup$
    – Debuggerrr
    Dec 24, 2017 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.