On Tue, Jun 5, 2012 at 10:49 AM, Nathaniel Smith wrote:
> On Tue, Jun 5, 2012 at 1:17 AM, Benjamin Root wrote:
> >
> >
> > On Monday, June 4, 2012, Chris Barker wrote:
> >>
> >> On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond
> >> wrote:
> >> > Here's how I sorted primarily by field 'a' descen
On Tue, Jun 5, 2012 at 1:17 AM, Benjamin Root wrote:
>
>
> On Monday, June 4, 2012, Chris Barker wrote:
>>
>> On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond
>> wrote:
>> > Here's how I sorted primarily by field 'a' descending and secondarily by
>> > field 'b' ascending:
>>
>> could you multiply
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
On Monday, June 4, 2012, Chris Barker wrote:
> On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond
> >
> wrote:
> > Here's how I sorted primarily by field 'a' descending and secondarily by
> > field 'b' ascending:
>
> could you multiply the numeric field by -1, sort, then put it back --
> somethign
On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond wrote:
> Here's how I sorted primarily by field 'a' descending and secondarily by
> field 'b' ascending:
could you multiply the numeric field by -1, sort, then put it back --
somethign like:
data *- -1
data_sorted = np.sort(data, order=['a','b'])
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