Skip to content

Instantly share code, notes, and snippets.

@prologic
Created May 7, 2015 03:23
Show Gist options
  • Save prologic/3100f5cac7c5be4333c3 to your computer and use it in GitHub Desktop.
Save prologic/3100f5cac7c5be4333c3 to your computer and use it in GitHub Desktop.
>>> import numpy
>>> data = numpy.genfromtxt("test.dat", names=["x", "y"])
>>> data
array([(0.0, 1.0), (0.1, 2.0), (0.2, 3.0), (0.3, 4.0), (0.5, 7.0),
(1.0, 9.0)],
dtype=[('x', '<f8'), ('y', '<f8')])
>>> data["x"]
array([ 0. , 0.1, 0.2, 0.3, 0.5, 1. ])
>>> data["y"]
array([ 1., 2., 3., 4., 7., 9.])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment