Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 592925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:47:28+00:00 2026-05-13T15:47:28+00:00

I have 2d array, dimension 3×10, and I want to sort by values in

  • 0

I have 2d array, dimension 3×10, and I want to sort by values in 2nd row, from lowest to highest value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:47:28+00:00Added an answer on May 13, 2026 at 3:47 pm

    Python, per se, has no “2d array” — it has (1d) lists as built-ins, and (1d) arrays in standard library module array. There are third-party libraries such as numpy which do provide Python-usable multi-dimensional arrays, but of course you’d be mentioning such third party libraries if you were using some of them, rather than just saying “in Python”, right?-)

    So I’ll assume that by “2d array” you mean a list of lists, such as:

    lol = [ range(10), range(2, 12), range(5, 15) ]
    

    or the like — i.e. a list with 3 items, each item being a list with 10 items, and the “second row” would be the sublist item lol[1]. Yeah, lots of assumptions, but your question is so maddeningly vague that there’s no way to avoid making assumptions – edit your Q to clarify with more precision, and an example!, if you dislike people trying to read your mind (and probably failing) as you currently make it impossible to avoid.

    So under these assumptions you can sort each of the 3 sublists in the order required to sort the second one, for example:

    indices = range(10)
    indices.sort(key = lol[1].__getitem__)
    for i, sublist in enumerate(lol):
      lol[i] = [sublist[j] for j in indices]
    

    The general approach here is to sort the range of indices, then just use that appropriately sorted range to reorder all the sublists in play.

    If you actually have a different problem, there will of course be different solutions;-).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 2-dimensional array of objects and I basically want to databind each
Let's say I have a .NET Array of n number of dimensions. I would
I have a 2 dimensional array, like so: char[,] str = new char[2,50]; Now,
I have a two dimensional array that I need to load data into. I
I have a one-dimensional array of strings in JavaScript that I'd like to turn
I have a two-dimensional array (of Strings) which make up my data table (of
A cancer CT picture is stored inside a unsigned short array (1-dimensional). I have
Inspired by Raymond Chen's post , say you have a 4x4 two dimensional array,
I have an array in Perl: my @my_array = (one,two,three,two,three); How do I remove
I have an array of numbers that potentially have up to 8 decimal places

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.