title: Need to extract the top values from a scatter (x-y) plot: highest X and highest Y
body: <p>I have a dataset with different values as follow: </p>
  
  <pre><code>     name   X   Y
         a    1   8
         b    11  12
         c    8   8
         d    4   13
         e    12  4
         f    11  11
         g    0   8
         h    0   9
         i    11  7
  </code></pre>
  
  <p>And a plot based on it: </p>
  
  <p><a href="https://i.stack.imgur.com/dku5b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dku5b.png" alt="enter image description here"></a></p>
  
  <p>What I need to get is a dataframe with the top 4 (in red circle) or top 'any number'. Something similar like this: </p>
  
  <pre><code>  name  X   Y
      b   11  12
      f   11  11
      i   11  7
      c   8   8
  </code></pre>
  
  <p>I've been using the following but it doesn't work well:</p>
  
  <pre><code>df1 = df.sort_values(['A', 'B'],ascending=False)
  print(df1)
  </code></pre>