title: Sum values of column by row and get the column that hits x % of total
body: <p>Okay, this is a bit difficult to describe. Basically, I have a dataframe like the following, where each column (from 0-90) represent a day, from day-0 to 90 days after day-90, and the numbers on each cell are sums of a certain feature for that ID in that day:</p>
  
  <pre><code>        ID      0   1   2   3   4   5   6   7   8   ... 81  82  83  84  85  86  87  88  89  90  total
  ------------------------------------------------------------------------------------------------------
  0       A       2   21  0   18  3   0   0   0   2   ... 0   0   0   0   0   0   0   0   0   0    156
  1       B       0   20  12  2   0   8   14  23  0   ... 0   0   0   0   0   0   0   0   0   0    231
  2       C       0   38  19  3   1   3   3   7   1   ... 0   0   0   0   0   0   0   0   0   0     78
  3       D       3   0   0   1   0   0   0   0   0   ... 0   0   0   0   0   0   0   0   0   0      5
  </code></pre>
  
  <p>What I need is the <strong>first one</strong> is a new column that displays the <em>number of the column at which the sum of previous values hit 90% of the 'total' value</em>. <strong>Example</strong>: For the first row, I want to know when (which day, somewhere between 0-90) the sum of values for that ID hit 90% of the total, which is 156. I would have a new column that would hold the value for the day that summed up to 90% of the total, something like this:</p>
  
  <pre><code>        ID      0   1   2   3   4   5   6   7   8   ... 81  82  83  84  85  86  87  88  89  90  total  day_90%
  --------------------------------------------------------------------------------------------------------------
  0       A       2   21  0   18  3   0   0   0   2   ... 0   0   0   0   0   0   0   0   0   0    156   54
  </code></pre>