linear_interpolation_calculation#
- caf.ntem.queries.linear_interpolation_calculation(data, output_year, upper_year, lower_year)[source]#
Perform linear interpolation between two years to produce a dataset for output year.
- Linear interpolation = ((output_year - lower_year) *
((upper_val - lower_val) / (upper_year - lower_year)) + lower_val)
- Parameters:
data (pd.DataFrame) – Dataframe to perform interpolation on. Should have segmentations as multi-indices, including ‘year’ (int) as one of the levels. ‘year’ must contain both upper_year and lower_year.
output_year (int) – Output year to produce data, should be between upper_year and lower_year.
upper_year (int) – year that exists in the data that is after output_year.
lower_year (int) – year that exists in the data that is before output_year.
- Returns:
Linearly interpolated data for the output year.
- Return type:
pd.DataFrame