Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dataset consisting of 'N' number of features/variables. One of these columns has missing values which I would like to interpolate. The interpolate() method of Pandas helps in doing so. The input for this method is the name of the column with missing values that needs to be interpolated, that's all.

What I have tried:

df["Column_4"].interpolate(method='linear')


In case of linear interpolation, a straight line is fit through the data points. Before doing so, how are the data points plotted in the graph? I understand the 'x-axis' contains the specified column values. What values are taken on the 'y-axis'?

Some sources state that y-axis takes 'index' values. If 'index' values are considered for each data point, won't we end up looking at a straight vertical line of data points instead of a scattered sea of data points?
Posted
Comments
[no name] 16-May-23 19:24pm    
In your case, the "x values" are "column numbers" ... because "column" is what you made reference to. (And not "month", for example). Some of those "N" numbers need to be "missing" (in there somewhere) in order to do any interpolating.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900