Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2017 00:20
Show Gist options
  • Save anonymous/b6e4c0c2aa3b90f82c49af9e640a050a to your computer and use it in GitHub Desktop.
Save anonymous/b6e4c0c2aa3b90f82c49af9e640a050a to your computer and use it in GitHub Desktop.
>>> from sklearn import preprocessing
>>> lb = preprocessing.LabelBinarizer()
>>> lb.fit_transform(['cat', 'dog', 'bird', 'cat'])
array([[0, 1, 0],
[0, 0, 1],
[1, 0, 0],
[0, 1, 0]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment