lenskit.data.from_interactions_df#

lenskit.data.from_interactions_df(df, *, user_col=None, item_col=None, rating_col=None, timestamp_col=None)#

Create a dataset from a data frame of ratings or other user-item interactions.

Todo

Repeated interactions are not yet supported.

Parameters:
  • df (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, or userId, with several case variants.

  • item_col (str | None) – The name of the item ID column. By default, looks for columns named item, item_id, or itemId, with several case variants.

  • rating_col (str | None) – The name of the rating column.

  • timestamp_col (str | None) – The name of the timestamp column.

Return type:

Dataset