kappa_sdk.remove_nan_from_vector#
- kappa_sdk.remove_nan_from_vector(vector, value=None)[source]#
Removes NaN or None entries from the input vector. The method creates a new vector based on the given vector while replacing NaN or None values with the supplied replacement value if specified. If a replacement value is not provided, only valid (non-NaN or non-None) data points are retained in the resulting vector.
- Parameters:
vector (
Vector
) – The input vector containing date-value pairs. The dates attribute represents the timestamps, and the values attribute contains associated values.value (
float
, optional) – The value that replaces NaN or None entries in the input vector. If not provided, the resulting vector only includes valid entries from the input vector.
- Returns:
Vector
– A new vector where NaN or None values are replaced with the given value (if specified) or are omitted. The output retains the structure of the input vector, preserving the order of valid data points while applying transformations for invalid entries (if needed).- Return type: