modelhub.Aggregate.session_duration
session_durationβ
(data, groupby=NotSet.token, exclude_bounces=True, method='mean')β[source]
Calculate the duration of sessions.
With default method
, it calculates the mean of the session duration over the groupby
.
Parametersβ
data
(bach.dataframe.DataFrame) βbach.DataFrame
to apply the method on.groupby
(Union[List[Union[str, bach.series.series.Series]], str, bach.series.series.Series, sql_models.constants.NotSet]) β sets the column(s) to group by.- if not_set it defaults to using
ModelHub.time_agg
. - if None it aggregates over all data.
- if not_set it defaults to using
exclude_bounces
(bool) β if True only session durations greater than 0 will be consideredmethod
(str) β βmeanβ or βsumβ
Returnsβ
series with results.