TruncatePaths#
Data processor#
- class retentioneering.data_processors_lib.truncate_paths.TruncatePaths(params)[source]#
Leave a sub-path bounded with a given conditions. Left and right boundary conditions are associated with
before
andafter
argument suffixes correspondingly. If any ofbefore
andafter
conditions do not meet, the path is excluded from the resulting eventstream entirely.- Parameters:
- drop_beforestr, optional
Event name before which part of the user’s path is dropped. The specified event remains in the data.
- drop_afterstr, optional
Event name after which part of the user’s path is dropped. The specified event remains in the data.
- occurrence_before{“first”, “last”}, default “first”
This parameter is necessary when the specified event occurs more than once in one user’s path.
when set to
first
, the part of the user path before the first event occurrence is dropped;when set to
last
, the part of the user path before the last event occurrence is dropped;
- occurrence_after{“first”, “last”}, default “first”
The same behavior as in the ‘occurrence_before’, but for the other part of the user path.
- shift_beforeint, default 0
Sets the number of steps by which the truncate point is shifted from the selected event. If the value is negative, then the offset occurs to the left along the timeline. If positive, then it occurs to the right.
- shift_afterint, default 0
The same behavior as in the
shift_before
, but for the other part of the user path.- ignore_beforebool, default False
If True, the resulting evenstream includes the paths that do not meet
before
condition.- ignore_afterbool, default False
If True, the resulting evenstream includes the paths that do not meet
after
condition.- keep_syntheticbool, default False
If True, all the synthetic events that are associated with the boundary events are kept in the output eventstream.
- Returns:
- Eventstream
Eventstream
with the truncated sub-paths.
Notes
See Data processors user guide for the details.
If a path contains a segment synthetic event before a
before
cut point, the last segment value that occurred before the cut point is inherited. See segments user guide.
- class retentioneering.data_processors_lib.truncate_paths.TruncatePathsParams(*, drop_before=None, drop_after=None, occurrence_before='first', occurrence_after='first', shift_before=0, shift_after=0, ignore_before=False, ignore_after=False, keep_synthetic=False)[source]#
A class with parameters for
TruncatePath
class.
Eventstream#
- TruncatePathsHelperMixin.truncate_paths(drop_before=None, drop_after=None, occurrence_before='first', occurrence_after='first', shift_before=0, shift_after=0, ignore_before=False, ignore_after=False, keep_synthetic=False)[source]#
A method of
Eventstream
class that truncates each user’s path based on the specified event(s) and selected parameters.- Parameters:
- drop_beforestr, optional
Event name before which part of the user’s path is dropped. The specified event remains in the data.
- drop_afterstr, optional
Event name after which part of the user’s path is dropped. The specified event remains in the data.
- occurrence_before{“first”, “last”}, default “first”
This parameter is necessary when the specified event occurs more than once in one user’s path.
when set to
first
, the part of the user path before the first event occurrence is dropped;when set to
last
, the part of the user path before the last event occurrence is dropped;
- occurrence_after{“first”, “last”}, default “first”
The same behavior as in the ‘occurrence_before’, but for the other part of the user path.
- shift_beforeint, default 0
Sets the number of steps by which the truncate point is shifted from the selected event. If the value is negative, then the offset occurs to the left along the timeline. If positive, then it occurs to the right.
- shift_afterint, default 0
The same behavior as in the
shift_before
, but for the other part of the user path.- ignore_beforebool, default False
If True, the resulting evenstream includes the paths that do not meet
before
condition.- ignore_afterbool, default False
If True, the resulting evenstream includes the paths that do not meet
after
condition.- keep_syntheticbool, default False
If True, all the synthetic events that are associated with the boundary events are kept in the output eventstream.
- Returns:
- Eventstream
Input
eventstream
with truncated paths.