On Sat, Jun 9, 2012 at 2:12 PM, bob tnur wrote:
>>
>> how to save multiple files like cm1.txt,cm2.txt,cm3.txt etc and to
>> produce their corresponding outputs cm1.out,cm2.out,cm3.out etc.
>
> or how to modify this:
> np.savetxt(fname, (a,b), fmt='%4.8f')
>
You can save them to separate fi
How do you want the output files to be formatted? Binary data? Textual
representation?
This function can do both:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tofile.html
And numpy supports a variety of methods for outputting to files (and
reading data back in):
http://docs.s
On Mon, Jun 4, 2012 at 6:08 PM, Chris Barker wrote:
> could you multiply the numeric field by -1, sort, then put it back
>
Yeah, that works great for my situation. Thanks Chris!
On Mon, Jun 4, 2012 at 8:17 PM, Benjamin Root wrote:
> While that may work for this users case, that would not work fo
Here's how I sorted primarily by field 'a' descending and secondarily by
field 'b' ascending:
(Note that 'a' is the second column, 'b' is the first)
>>> data
array([('b', 0.03),
('c', 0.03),
('f', 0.03),
('e', 0.01),
('d', 0.04),
('a', 0.04)],
dtype=[('b',
Hi!
I have a one-dimensional ndarray with two fields. I'd like to sort in
descending order by field 'a', breaking ties by sorting in ascending
order by field 'b'.
I've found combinations of sorting and reversing followed by stable
sorting that work, but there must be a straightforward way to do i