Home>

As the title suggests, "I want to interpolate (insert) only the specified number of average values ​​between two points (for example, insert five average values ​​between two points)" in python.
When I examined it myself, there was a function interpolate.interp1d that rewrites NaN with the average around it, but

Is there any function that extrapolates the average value between two points by the specified number? ?
If it doesn't exist, I'm trying to write it.

  • Answer # 1

    Once you convert to a pandas DataFrame and use the interpolate () method, it will complete all at once. The code is written as follows.

    df.interpolate ()


    Probably the completion method meets your needs with the default linear, but check the official documentation. The direction (vertical/horizontal) of the data to be complemented can also be specified, so please use it according to the data

Related articles