title: Filter list of dictionaries by key value - return answers as a list of dictionaries
body: <p>I have a list of dictionaries that I want to filter.</p>
  
  <pre><code>[{"Slope": -0.562, "Count": 3},
   {"Slope": -0.362, "Count": 6},
   {"Slope": -0.762, "Count": 8},
   {"Slope": -0.562, "Count": 12},
   {"Slope": 2.5, "Count": 34},
   {"Slope": 1.52, "Count": 2},
   {"Slope": .56, "Count": 6}]
  </code></pre>
  
  <p>My goal is to get a list of two dictionaries. One with the "highest count and a POSITVE slope" and the other with the "highest count and NEGATIVE slope".</p>
  
  <p>My plan was to filter all the positive and negative ones out, then sort each list and then create a new list with the first record of each. </p>
  
  <p>Sorting the list isnt an issue for me, i've got this! </p>
  
  <pre><code>lines_lst.sort(key=lambda i: i['lines_count'])
  </code></pre>
  
  <p>But filtering doesn't seem to work when I try this as it returns a dictionary.</p>
  
  <pre><code>positive_lines = next(item for item in lines_lst if item["Slope"] &gt; 0)
  </code></pre>
  
  <p>Does anyone have a solution that ends up with the below?</p>
  
  <pre><code>[{"Slope": -0.562, "Count": 12},{"Slope": 2.5, "Count": 34}]
  </code></pre>