get_contextο
- rectools.dataset.context.get_context(df: DataFrame) DataFrame[source]ο
Extract initial interaction context for each user.
For each user, finds the earliest index base on datetime and uses it to define the initial contextual data. If the item column is present, it is dropped from the result, as itβs not part of the user context.
- Parameters
df (pd.DataFrame) β Input DataFrame containing user interactions with at least user ID and datetime columns.
- Returns
A DataFrame with one row per user, representing the earliest context data for that user.
- Return type
pd.DataFrame