Returns a function that shifts all values of a single time series by the specified delta.
For a source time series with points (timestamp, value)
, upon shifting by delta
,
the resulting value-shifted time series will have points (timestamp, value + delta)
.
FunctionNode
) -> FunctionNode
Column name | Type | Description |
---|---|---|
timestamp | pandas.Timestamp | Timestamp of the point |
value | float | Shifted value of the point |
This function is only applicable to numeric series.
Copied!1>>> series = F.points( 2... (100, 0.0), 3... (200, float("inf")), 4... (300, 3.14159), 5... (2147483647, 1.0), 6... name="series" 7... ) 8>>> series.to_pandas() 9 timestamp value 100 1970-01-01 00:00:00.000000100 0.00000 111 1970-01-01 00:00:00.000000200 inf 122 1970-01-01 00:00:00.000000300 3.14159 133 1970-01-01 00:00:02.147483647 1.00000
Copied!1>>> value_shifted = F.value_shift(3.0)(series) 2>>> value_shifted.to_pandas() 3 timestamp value 40 1970-01-01 00:00:00.000000100 3.00000 51 1970-01-01 00:00:00.000000200 inf 62 1970-01-01 00:00:00.000000300 6.14159 73 1970-01-01 00:00:02.147483647 4.00000
Copied!1>>> negative_value_shifted = F.value_shift(-3.0)(series) 2>>> negative_value_shifted.to_pandas() 3 timestamp value 40 1970-01-01 00:00:00.000000100 -3.00000 51 1970-01-01 00:00:00.000000200 inf 62 1970-01-01 00:00:00.000000300 0.14159 73 1970-01-01 00:00:02.147483647 -2.00000