title: How do I sort records in descending order based on a extracted numerical value from a string in python?
body: <pre><code>I have a data set like this: 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/zNwQi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zNwQi.png" alt="enter image description here"></a></p>
  
  <pre><code> Surface Book 2 Review: How Microsoft Won My Five Stars At The Edinburgh Fringe | 0.5047957
   Remove the Power PC Care 2018 PUP | 0.44716716
   9 Months of Xbox Live (New or Returning Only, otherwise 7 months for $21) $23 | 0.42284298
   US probe into Microsoft software sales in Hungary | 0.42226338
  </code></pre>
  
  <p>I am trying to sort the data based on the values which exists after <code>|</code> symbol. So basically I would like to display the whole string based on which ever has highest value and get top 10. </p>
  
  <pre><code> I tried doing this but I cannot figure out how to order by only that numerical value. 
  
   listnew = sorted(Calculatedvalues, key = lambda x : x[1], reverse = True)[:10]
   for item in listnew:
                   print (item)
  </code></pre>
  
  <p>My output is like this: </p>
  
  <pre><code>３８ What is Thinking？ #Intelligence | 0.15786803
  ３８ What is Thinking？ #Intelligence | 0.15786803
  ８．３１ PF | 0.02431465
  ️ Hop on, Jerry. Here are 50 points. | 0.25864878
  </code></pre>
  
  <p>If we see the score these are basically lower from what exists in a data set, I understand this is not the right way, and I was not able to find a way to order based on just specific part. </p>
  
  <p>I referred to answers provided in these questions, but it did not help. </p>
  
  <p><a href="https://stackoverflow.com/questions/17295060/sort-the-top-ten-results">Sort the top ten results</a></p>
  
  <p>from one of the answers provided below: I tried using this approach mentioned</p>
  
  <pre><code>Calculatedvalues.sort(key = lambda x: x.split("(")[1]))
  </code></pre>
  
  <p>but I am receiving this error</p>
  
  <pre><code>list index out of range
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/21431052/sort-list-of-strings-by-a-part-of-the-string">Sort list of strings by a part of the string</a> </p>