Sorting a Numpy array by column not axis [duplicate]Sorting arrays in NumPy by columnHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesHow do I sort a dictionary by value?Sorting an array of JavaScript objects by propertySort array of objects by string property valueHow to sort a dataframe by multiple column(s)How to Sort Multi-dimensional Array by Value?Fastest sort of fixed length 6 int arrayNumpy array dimensionsSwift Beta performance: sorting arrays

How to call made-up data?

Is the first page of a novel really that important?

Generate random number in Unity without class ambiguity

Ancients don't give a full level?

What are the function of EM and EN spaces?

Could an areostationary satellite help locate asteroids?

What does the ISO setting for mechanical 35mm film cameras actually do?

Description of past perfect tense

Does a humanoid possessed by a ghost register as undead to a paladin's Divine Sense?

How to check a file was encrypted (really & correctly)

Pronouns when writing from the point of view of a robot

Would this winged human/angel be able to fly?

Repeated! Factorials!

How to win against ants

Why are there yellow dot stickers on the front doors of businesses in Russia?

Is a switch from R to Python worth it?

How many years before enough atoms of your body are replaced to survive the sudden disappearance of the original body’s atoms?

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

What is an air conditioner compressor hard start kit and how does it work?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

Identify Batman without getting caught

Not been paid even after reminding the Treasurer; what should I do?

Why when the leprosy covers the entire body the leper is pronounced pure?

FORMATDATE and format pattern to add year when using format pattern "M"



Sorting a Numpy array by column not axis [duplicate]


Sorting arrays in NumPy by columnHow do I sort a list of dictionaries by a value of the dictionary?Sort a Map<Key, Value> by valuesHow do I sort a dictionary by value?Sorting an array of JavaScript objects by propertySort array of objects by string property valueHow to sort a dataframe by multiple column(s)How to Sort Multi-dimensional Array by Value?Fastest sort of fixed length 6 int arrayNumpy array dimensionsSwift Beta performance: sorting arrays






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0
















This question already has an answer here:



  • Sorting arrays in NumPy by column

    9 answers



I have a numpy array that is equivalent to:



array([[51, 62, 23],
[24, 45, 16],
[67, 78, 39]])


Just much bigger. I'm trying to sort by the second column (ie. the number 62, 45, 78) but keep the horizontal elements together. The output I'm trying to get would be:



array([[24, 45, 16],
[51, 62, 23],
[67, 78, 39]])


I can't figure out how to do this with np.sort - I don't think this is the correct function for the job (although I'm a bit new to numpy so I might be wrong) - I'm happy to learn a new function, code snippets would be great, but a simple 'use np.blah' would suffice :D










share|improve this question














marked as duplicate by cs95 numpy
Users with the  numpy badge can single-handedly close numpy questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 27 at 4:06


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

























    0
















    This question already has an answer here:



    • Sorting arrays in NumPy by column

      9 answers



    I have a numpy array that is equivalent to:



    array([[51, 62, 23],
    [24, 45, 16],
    [67, 78, 39]])


    Just much bigger. I'm trying to sort by the second column (ie. the number 62, 45, 78) but keep the horizontal elements together. The output I'm trying to get would be:



    array([[24, 45, 16],
    [51, 62, 23],
    [67, 78, 39]])


    I can't figure out how to do this with np.sort - I don't think this is the correct function for the job (although I'm a bit new to numpy so I might be wrong) - I'm happy to learn a new function, code snippets would be great, but a simple 'use np.blah' would suffice :D










    share|improve this question














    marked as duplicate by cs95 numpy
    Users with the  numpy badge can single-handedly close numpy questions as duplicates and reopen them as needed.

    StackExchange.ready(function()
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function()
    $hover.showInfoMessage('',
    messageElement: $msg.clone().show(),
    transient: false,
    position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
    dismissable: false,
    relativeToBody: true
    );
    ,
    function()
    StackExchange.helpers.removeMessages();

    );
    );
    );
    Mar 27 at 4:06


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0


      1







      This question already has an answer here:



      • Sorting arrays in NumPy by column

        9 answers



      I have a numpy array that is equivalent to:



      array([[51, 62, 23],
      [24, 45, 16],
      [67, 78, 39]])


      Just much bigger. I'm trying to sort by the second column (ie. the number 62, 45, 78) but keep the horizontal elements together. The output I'm trying to get would be:



      array([[24, 45, 16],
      [51, 62, 23],
      [67, 78, 39]])


      I can't figure out how to do this with np.sort - I don't think this is the correct function for the job (although I'm a bit new to numpy so I might be wrong) - I'm happy to learn a new function, code snippets would be great, but a simple 'use np.blah' would suffice :D










      share|improve this question















      This question already has an answer here:



      • Sorting arrays in NumPy by column

        9 answers



      I have a numpy array that is equivalent to:



      array([[51, 62, 23],
      [24, 45, 16],
      [67, 78, 39]])


      Just much bigger. I'm trying to sort by the second column (ie. the number 62, 45, 78) but keep the horizontal elements together. The output I'm trying to get would be:



      array([[24, 45, 16],
      [51, 62, 23],
      [67, 78, 39]])


      I can't figure out how to do this with np.sort - I don't think this is the correct function for the job (although I'm a bit new to numpy so I might be wrong) - I'm happy to learn a new function, code snippets would be great, but a simple 'use np.blah' would suffice :D





      This question already has an answer here:



      • Sorting arrays in NumPy by column

        9 answers







      python-3.x numpy sorting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 3:39









      FraserOfSmegFraserOfSmeg

      6921 gold badge14 silver badges27 bronze badges




      6921 gold badge14 silver badges27 bronze badges





      marked as duplicate by cs95 numpy
      Users with the  numpy badge can single-handedly close numpy questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 4:06


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











      marked as duplicate by cs95 numpy
      Users with the  numpy badge can single-handedly close numpy questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 4:06


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by cs95 numpy
      Users with the  numpy badge can single-handedly close numpy questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 27 at 4:06


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          1 Answer
          1






          active

          oldest

          votes


















          1














          If your numpy array is arr, this should work: arr[arr[:,1].argsort()]






          share|improve this answer




























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            If your numpy array is arr, this should work: arr[arr[:,1].argsort()]






            share|improve this answer





























              1














              If your numpy array is arr, this should work: arr[arr[:,1].argsort()]






              share|improve this answer



























                1












                1








                1







                If your numpy array is arr, this should work: arr[arr[:,1].argsort()]






                share|improve this answer













                If your numpy array is arr, this should work: arr[arr[:,1].argsort()]







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 3:48









                JoshJosh

                409 bronze badges




                409 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.





                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해