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
  Creating A List of DataFrames & Manipulating Columns in Each DataFrame firebird 1 231 Jul-31-2019, 04:04 AM
Last Post: scidam
  Compare between 2 DataFrames Nidhesh 2 244 Jul-26-2019, 08:16 AM
Last Post: Nidhesh
  Giving index when joining dataframes kw42chan 1 407 Jul-06-2019, 06:19 AM
Last Post: kw42chan
  Could anyone help me get the jaccard distance between my dataframes please? :) a_real_phoenix 0 447 Jun-27-2019, 06:01 PM
Last Post: a_real_phoenix
  Two dataframes merged Ecniv 10 809 Jun-16-2019, 09:10 PM
Last Post: Ecniv
  Statistical analysis of two dataframes zhl 1 572 Jun-11-2019, 07:26 PM
Last Post: Ecniv
  Sum product multiple Dataframes based on column headers. Lastwizzle 0 656 May-21-2019, 04:05 PM
Last Post: Lastwizzle
  Why can't I merge pandas dataframes learnpython2018 2 1,189 Sep-23-2018, 05:53 PM
Last Post: learnpython2018

Forum Jump:


Users browsing this thread: 1 Guest(s)