Skip to content

Instantly share code, notes, and snippets.

@richard-to
Created June 6, 2014 00:59
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 richard-to/0fcd4d5251a80121a731 to your computer and use it in GitHub Desktop.
Save richard-to/0fcd4d5251a80121a731 to your computer and use it in GitHub Desktop.
Numpy slicing to get last column and everything but last column
data = np.array([
[1.0, 1.1, 1],
[1.0, 1.0, 1],
[0.0, 0.0, 2],
[0.0, 0.1, 2],
])
labels = data[:,-1]
points = data[0:,:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment