title: How to interrupt while using apply function on a pandas dataframe python?
body: <p>Is there a way to use the <code>apply</code> function to calculate a new column for a <code>pandas</code> <code>dataframe</code> but "interrupt" it based on some criteria.</p>
  
  <p>Say I have a dataframe with 2000 rows and my criteria, which is dependent on the previously calculated applied values, turns to <code>false</code> at the 1000-th. Calculating the next 1000 is a waste and I would want <code>pandas</code> to stop "applying" after the 1000-th and give me back what it's calculated so far.</p>
  
  <p>Is that possible ?</p>