[SciPy-user] Sort by first n columns in an array
Thu Jul 9 10:21:06 CDT 2009
>>> Neil Crighton <firstname.lastname@example.org> 7/8/2009 6:14 PM >>>
>Something like this should work:
>data = np.genfromtxt(filename, dtype=None, usecols=(0,1,2),
>data.sort(order=['year', 'month', 'day'])
That works if I know the number of columns prior to reading the file. In this case I'm reading a file with an unknown number of columns. I know that the first six columns are the date fields.
More information about the SciPy-user