[SciPy-user] Sort by first n columns in an array
Mon Jul 13 09:26:35 CDT 2009
> But it's probably better to let genfromtxt choose its own field names and then
> sort the whole thing using the first 6 fields.
> alldata = np.genfromtxt(filename, dtype=None)
> alldata.sort(order='f0 f1 f2 f3 f4 f5'.split())
Great, this is exactly what I needed. I had thought of the first approach but didn't want to have to read the file in twice.
More information about the SciPy-user