Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sandy4321/3b76512dee75af68dc10bfad397f8910 to your computer and use it in GitHub Desktop.
Save Sandy4321/3b76512dee75af68dc10bfad397f8910 to your computer and use it in GitHub Desktop.
Create the preference column.
# more than 3 -> 1, less than 5 -> 0
data_df['preference'] = np.where(data_df['rating'] > 3, 1, 0)
data_df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment