title: Stop apply when condition is met
body: <p>I have a pandas DataFrame with 1,000 columns and 30 million sample rows. I need to perform some operations(lets say addition,multiplication etc.,) on each column. If some value in any column after operation changes to 0, then I need to stop applying operations further on remaining columns and rows. Also, I would like to know at which column and row it changed to 0.</p>
  
  <p>I have used iterrows with a few checks, but there is a performance issue as there is lots of data. Also, is there any alternatives to apply, iterrows?</p>
  
  <pre><code>ID   PID     PC   TID
  10   1005   8017  3
  11   10335  5019  2
  12   1000   8017  1
  13   243    8870  1
  14   4918   8305  3
  15   9017   8305  3
  </code></pre>
  
  <p>Apply operations column-wise:</p>
  
  <ul>
  <li>Col1 subtract by 9.</li>
  <li>Col2 subtract by 1000.</li>
  <li>Col3 divide by 100.</li>
  <li>Col4 subtract by 1.</li>
  </ul>
  
  <p>After doing apply on second column, 3rd value is 0 and then whole process should be stopped and return the 2nd column 3rd row. </p>
  
  <p>Output: 
  If Column wise operations are performed:</p>
  
  <pre><code>ID   PID    PC     TID
  1    5      8017   3
  2    9335   5019   2
  3    0      8017   1
  4    243    8870   1
  5    4918   8305   3
  6    9017   8305   3
  </code></pre>
  
  <p>If row wise operations are performed :</p>
  
  <pre><code>ID   PID    PC      TID
  1    5      80.17   2
  2    9335   50.19   1
  3    0      8017    1
  13   243    8870    1
  14   4918   8305    3
  15   9017   8305    3
  </code></pre>