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

  • Home
  • SEARCH
  • 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 4250160
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:29:31+00:00 2026-05-21T04:29:31+00:00

My apologies if I am using the incorrect terminology, as I’m a bit of

  • 0

My apologies if I am using the incorrect terminology, as I’m a bit of a Python n00b when it comes to the proper descriptions for data structures.

I have a data structure that looks like this:

{
    u'COU': {'hl': 39, 'hw': 42, 'winPct': Decimal('0.5471698113207547169811320755'), 'al': 36, 'l': 72, 'w': 87, 'aw': 45}, 
    u'MIN': {'hl': 42, 'hw': 39, 'winPct': Decimal('0.3559322033898305084745762712'), 'al': 57, 'l': 114, 'w': 63, 'aw': 24}, 
    u'BOW': {'hl': 36, 'hw': 44, 'winPct': Decimal('0.5432098765432098765432098765'), 'al': 37, 'l': 74, 'w': 88, 'aw': 44}
}

I want to sort this data structure by the value in winPct inside the inner dict and searching online has revealed a dazzling array of advice that makes no sense to this raised-on-PHP developer.

Thanks in advance for your help.

  • 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-21T04:29:31+00:00Added an answer on May 21, 2026 at 4:29 am

    You can’t sort a dictionary, but you could convert the dictionary into a list of tuples with the form (key, value).

    sorted_d = sorted(d.iteritems(), key=lambda v: v[1]['winPct'])
    

    To Reverse the sorting as per your comment use:

    sorted_d = sorted(d.iteritems(), key=lambda v: v[1]['winPct'], reverse=True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to python, apologies if this has been asked already. Using python
Apologies if this kind of thing has been answered elsewhere. I am using Python
I apologize if I use the incorrect terminology here, I've only been using emacs
Apologies in advance if I'm using the wrong terminology, I'm pretty new to jQuery.
Apologies if this is a dumb question. In previous ASP.NET projects, I've been using
Apologies for the poor question title. I have two tables, jobs and Persons-Jobs. Jobs
I understand that the title was very vague and my apologies. I am using
Apologies in advance but I have never seen this error before and don't know
I apologize in advance if the terminology in my question is incorrect. I want
Apologies for using someone else's brain for this, but I'm sure this is a

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.