lenskit.data.from_interactions_df#
- lenskit.data.from_interactions_df(df, *, user_col=None, item_col=None, rating_col=None, timestamp_col=None, users=None, items=None)#
Create a dataset from a data frame of ratings or other user-item interactions.
- Stability:
- Caller (see Stability Levels).
- Parameters:
df (pd.DataFrame) – The user-item interactions (e.g. ratings). The dataset code takes ownership of this data frame and may modify it.
user_col (str | None) – The name of the user ID column. By default, looks for columns named
user
,user_id
, oruserId
, with several case variants.item_col (str | None) – The name of the item ID column. By default, looks for columns named
item
,item_id
, oritemId
, with several case variants.rating_col (str | None) – The name of the rating column.
timestamp_col (str | None) – The name of the timestamp column.
user_ids – A vocabulary of user IDs. The data frame is subset to this set of IDs.
item_ids – A vocabulary of item IDs. The data frame is subset to this set of IDs.
users (IDSequence | pd.Index | Iterable[ID] | Vocabulary | None)
items (IDSequence | pd.Index | Iterable[ID] | Vocabulary | None)
- Returns:
The initiated data set.
- Return type: