title: Python Data Frame: cumulative sum of column until condition is reached and return the index
body: <p>I am new in Python and am currently facing an issue I can't solve. I really hope you can help me out. English is not my native languge so I am sorry if I am not able to express myself properly.</p>
  
  <p>Say I have a simple data frame with two columns:</p>
  
  <pre><code>index  Num_Albums  Num_authors
  0      10          4
  1      1           5
  2      4           4
  3      7           1000
  4      1           44
  5      3           8
  
  Num_Abums_tot = sum(Num_Albums) = 30
  </code></pre>
  
  <p>I need to do a cumulative sum of the data in <code>Num_Albums</code> until a certain condition is reached. Register the index at which the condition is achieved and get the correspondent value from <code>Num_authors</code>.</p>
  
  <p>Example:
  cumulative sum of <code>Num_Albums</code> until the sum equals 50% ± 1/15 of 30 (--> 15±2):</p>
  
  <pre><code>10 = 15±2? No, then continue;
  10+1 =15±2? No, then continue
  10+1+41 = 15±2? Yes, stop. 
  </code></pre>
  
  <p>Condition reached at index 2. Then get <code>Num_Authors</code> at that index: <code>Num_Authors(2)=4</code></p>
  
  <p>I would like to see if there's a function already implemented in <code>pandas</code>, before I start thinking how to do it with a while/for loop....</p>
  
  <p>[I would like to specify the column from which I want to retrieve the value at the relevant index (this comes in handy when I have e.g. 4 columns and i want to sum elements in column 1, condition achieved =yes then get the correspondent value in column 2; then do the same with column 3 and 4)].</p>