Skip to content

Instantly share code, notes, and snippets.

@dpoulopoulos
Last active March 8, 2020 21:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dpoulopoulos/3e724aee5ca5f2da9deb39cccd071a8f to your computer and use it in GitHub Desktop.
Save dpoulopoulos/3e724aee5ca5f2da9deb39cccd071a8f 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()
@Sandy4321
Copy link

Do you have full code from 0 to end example?
Great post , thanks

@dpoulopoulos
Copy link
Author

Hi! Thanks :)

You can find the example of the first post here: https://github.com/dpoulopoulos/cf_step/blob/master/nbs/index.ipynb

Just change the cells that are specified in the second post to get a working example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment