Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created November 22, 2020 08:24
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 amankharwal/71ebb803f204cfd40dc7468a2ddbda61 to your computer and use it in GitHub Desktop.
Save amankharwal/71ebb803f204cfd40dc7468a2ddbda61 to your computer and use it in GitHub Desktop.
def cat_to_num(data):
categories = unique(data)
features = []
for cat in categories:
binary = (data == cat)
features.append(binary.astype("int"))
return features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment