Created
August 20, 2017 16:18
-
-
Save idling-mind/2b1e6cf4e3dc6f0e2b943e5c34dab881 to your computer and use it in GitHub Desktop.
Interpolation for a single point for x-y data from pandas dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
mydata = pd.DataFrame({ | |
"Temp":[10,20,30,40,50], | |
"Data":[123,323,335,567,886] | |
}) | |
point_to_interpolate = 33 | |
interpolated_data = np.interp(x=point_to_interpolate, xp=mydata.Temp, fp=mydata.Data) | |
# Returns 404.6 which is same as (567-335)/10*3+335 |
Author
idling-mind
commented
Aug 20, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment