kappa_sdk.apply_factor#
- kappa_sdk.apply_factor(vector, value, start_date=None, end_date=None)[source]#
Applies a scaling factor to the values of a vector, optionally only within a given time range.
- Parameters:
vector (
Vector) – The vector object whose values are to be scaled. It contains dates and a list of numerical values.value (
float) – The scaling factor by which to multiply each value in the vector.start_date (
datetime, optional) – Start date of the time range in which the factor should be applied. If None, the range starts from the beginning of the vector.end_date (
datetime, optional) – End date of the time range in which the factor should be applied. If None, the range ends at the end of the vector.
- Returns:
Vector– A new Vector object with the adjusted values and the original dates and first_x attributes preserved.- Return type: