Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Interpolate using multiple dataframes
#1
I am trying to perform an interpolation based on the input data ( test_data_Inputs) on the test_data data frame. The way I have it set up now is I do it by Peril so so I first created a dataframe that only contained the fire peril (see below) then perform the interpolation on that specific peril group:

The goal is to have a column in the test_data_inputs that has both the Peril Type, and Factor. One of the issues I have been encountering is the situation where the amount of insurance in the test_data_input is a perfect match within the test_data dataframe. It still interpolates regardless of if it is a perfect match or not.


fire_peril_test=test_data[test_data['Peril Type'=='Fire']]
from scipy import interpolate
x=fire_peril_test['Amount Of Insurance']
y=fire_peril_test['Factor']
f=interpolate.interp1d(x,y)
xnew=test_data_Inputs["Amount of Insurance"]
ynew=f(xnew)


test_data_Inputs=pd.DataFrame({'Amount of Insurance':[320000,330000,340000]})
test_data=pd.DataFrame({'Amount of Insurance':[300000,350000,400000,300000,350000,400000],'Peril Type':['Fire','Fire','Fire','Water','Water','Water'],'Factor':[.10,.20,.35,.20,.30,.40]})
Appreciate all the assistance
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Can I interpolate if I don't know the function I am dealing with? player1681 2 196 Jan-30-2020, 02:41 PM
Last Post: player1681
  Merging two DataFrames based on indexes from two other DataFrames lucinda_rigeitti 0 207 Jan-16-2020, 08:36 PM
Last Post: lucinda_rigeitti
  Sum product multiple Dataframes based on column headers. Lastwizzle 0 1,303 May-21-2019, 04:05 PM
Last Post: Lastwizzle

Forum Jump:


Users browsing this thread: 1 Guest(s)