title: Dataframe : rolling windows with "vlookup"
body: <p>I have a dataframe like that : </p>
  
  <pre><code>VALUE   ATTRIBUTE
  300         K
  200         B
  100         CC
  150         D
  100         EF
  150         G
  100         T
  200         D
  300         EF
  400         T
  350         G
  400         F
  550         FE
  600         EF
  700         D
  650         F
  400         EF
  300         R
  </code></pre>
  
  <p>For each row, I want to perform a rolling-window (size = 5) in the next rows and return : </p>
  
  <ul>
  <li><p>max value</p></li>
  <li><p>related attribute</p></li>
  </ul>
  
  <p>For example, the first row (300 K) has to return both :</p>
  
  <ul>
  <li><p>max value of 5 next rows => <strong>200</strong></p></li>
  <li><p>related attribute => <strong>B</strong></p></li>
  </ul>
  
  <p>I'm performing a rolling windows in the future sequences (not in the previous one). Hence I'm shifting in my code.</p>
  
  <p>I'm facing a problem since I'm able to return MAX_VALUE, but don't know how to return ATTRIBUTE related to max value. Below is the code i'm currently running : </p>
  
  <pre><code>df['MAX_VALUE'] = df['VALUE'].rolling(5).max().shift(-5)
  </code></pre>
  
  <p><strong>Do you have any suggestions to perform that function ?</strong></p>
  
  <p>Expected results are: </p>
  
  <pre><code>VALUE   ATTRIBUTE   MAX_VALUE    ATTRIBUTE_MAX_VALUE
  300         K       200      B
  200         B       150      D
  100         CC      200      D
  150         D       300      EF
  100         EF      400      T
  150         G       400      T
  100         T       400      T
  200         D       550      FE
  300         EF      600      EF
  400         T       700      D
  350         G       700      D
  400         F       700      D
  550         FE      700      D
  600         EF      700      D
  700         D       650      F
  650         F       400      EF
  400         EF      300      R
  300         R       nan      nan
  </code></pre>
  
  <p><strong>Many thanks for your help !!</strong></p>