vDataFrame.sessionize¶
In [ ]:
vDataFrame.sessionize(ts: str,
by: list = [],
session_threshold: str = "30 minutes",
name: str = "session_id")
Adds a new vcolumn to the vDataFrame that corresponds to user sessions (user activity during a specific time). A session ends when ts - lag(ts) is greater than the specified threshold.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
ts | str | ❌ | vcolumn used as timeline. It will be to use to order the data. It can be a numerical or type date like (date, datetime, timestamp...) vcolumn. |
by | list | ✓ | vcolumns used in the partition. |
session_threshold | str | ✓ | This parameter is the threshold which will determine the end of the session. For example, if it is set to '10 minutes' the session ends after 10 minutes of inactivity. |
name | str | ✓ | The session name. |
Returns¶
vDataFrame : self
Example¶
In [72]:
from verticapy import vDataFrame
expedia = vDataFrame("public.expedia").select(["date_time", "user_id"])
display(expedia)
In [73]:
# Creating use session: incremental label. It increments when the user
# did not click for more than 30 minutes.
expedia.sessionize(ts = "date_time",
by = ["user_id"],
session_threshold = "30 minutes")
Out[73]:
See Also¶
| vDataFrame.analytic | Adds a new vcolumn to the vDataFrame by using an advanced analytical function on a specific vcolumn. |
