title: First occurrence of a specific value in a row (prepping for survival analysis) - python
body: <p><a href="https://i.stack.imgur.com/yUONg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yUONg.png" alt="enter image description here" /></a></p>
  <p>I have the following data (see attached - easier this way). I am trying to find the first occurrence of the value 0 for each customer ID. Then, I plan to use code similar to below to create a Kaplan-Meier curve:</p>
  <pre><code>    from lifelines import KaplanMeierFitter
  
  ## Example Data 
  durations = [5,6,6,2.5,4,4]
  event_observed = [1, 0, 0, 1, 1, 1]
  
  ## create a kmf object
  kmf = KaplanMeierFitter() 
  
  ## Fit the data into the model
  kmf.fit(durations, event_observed,label='Kaplan Meier Estimate')
  
  ## Create an estimate
  kmf.plot(ci_show=False) ## ci_show is meant for Confidence interval, since our data set is too tiny, thus i am not showing it.
  </code></pre>
  <p>(this code is from <a href="https://towardsdatascience.com/survival-analysis-intuition-implementation-in-python-504fde4fcf8e" rel="nofollow noreferrer">here</a>).</p>
  <p>What' the simplest way to do this? Note that I want to ignore the NAs: I have plenty of them and there's no getting around that.</p>
  <p>Thanks!</p>