Dear Rohit,
I noticed that this method can't be used when we have missing data at the end of the main list.
The Length of data and dataNEW is not the same. Is there any way to use interpolation and extrapolation for a list simultaneously?
data = {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 5.8`,
0.`, 0.8`, 0.`, 0.`, "NaN", "NaN", "NaN", 7.7`, 6.2`, 0.`, 0.`,
0.`, "NaN", "NaN"};
ListLinePlot[data, PlotRange -> All]
int = Interpolation[
Select[Transpose[{Range[Length[data]], data}], NumericQ[Last[#]] &],
InterpolationOrder -> 1]
dataNEW = Table[int[x], {x, 1, 24}]
Length /@ {data, dataNEW}