TruncatePaths#

Data processor#

class retentioneering.data_processors_lib.truncate_paths.TruncatePaths(params)[source]#

Remove events that will be deleted from each user’s path based on the specified event 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.

Returns:
Eventstream

Eventstream with events that should be deleted from input eventstream.

Notes

Step - is the group of events in the user path with the same timestamp. If the user path doesn’t contain events from drop_before and drop_after parameters, then its path does not change.

See Data processors user guide for the details.

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)[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)[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.

Returns:
Eventstream

Input eventstream with truncated paths.