slice_time_series
SliceTimeSeries(time_series, slice_points)
Bases: Transform
Slices a time series at given slice points.
The transform takes two columns as input: 'time_series' and 'slice_points.' The 'time_series' column is sliced at the points specified by the 'time' entry of the 'slice_points' column. The result is a new time series column where each entry contains only the values from the original time series that fall between the specified slice points.
Suppose you have a dataframe with a single line entry as follows:
time_series | slice_points |
---|---|
[(00:00:03, 1), | [(00:00:05, 0), |
(00:00:04, 2), | (00:00:08, 1)] |
(00:00:06, 7), | |
(00:00:09, 0)] |
Applying the slice time series transform results in a multi-line dataframe, where each line corresponds to a slice point:
time_series | slice_points |
---|---|
[(00:00:03, 1), | [(00:00:05, 0)] |
(00:00:04, 2)] | |
[(00:00:06, 7)] | [(00:00:08, 1)] |
The transform operates line-wise, meaning that each line in the input dataframe is processed independently. The resulting dataframe will have multiple lines depending on the number of slice points specified in each line.
Initialize the SliceTimeSeries transform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_series
|
str
|
the time series column to slice. |
required |
slice_points
|
str
|
the column that specifies the slice points. |
required |
Source code in src/flowcean/polars/transforms/slice_time_series.py
45 46 47 48 49 50 51 52 53 54 55 |
|