Skip to content

Instantly share code, notes, and snippets.

@Kamaldeep0077
Created December 6, 2020 07:22
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 Kamaldeep0077/f541897e08ad2b634b05ea84f7ea0f61 to your computer and use it in GitHub Desktop.
Save Kamaldeep0077/f541897e08ad2b634b05ea84f7ea0f61 to your computer and use it in GitHub Desktop.
#define bins
bins = [0, 70, 140, 210, 280]
#name of groups
groups = ['Low', 'Med', 'High', 'Exp']
data['Item_MRP_Bin_cut'] = pd.cut(data['Item_MRP'], bins=bins, labels=groups)
data[['Item_MRP', 'Item_MRP_Bin_cut']].head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment