title: Pandas DataFrame Repeat Value Based on a Condition
body: <p>I'm trying to repeat row values in a DataFrame based on conditions in a column. If the value in column Change = 1, then I'd like to repeat the values in columns A, B, and C until the next Change = 1.</p>
  
  <pre><code>index = pandas.date_range('20000131', periods=5)
  columns = ['A', 'B', 'C', 'Change']
  
  data = {'A': pandas.Series([False, True, False, True, False], index=index)
      , 'B': pandas.Series([True, True, False, False, False], index=index)
      , 'C': pandas.Series([True, False, True, True, True], index=index)
      , 'Change' : pandas.Series([1,0,0,1,0], index=index)}
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>                A      B      C  Change
  2000-01-31  False   True   True       1
  2000-02-01   True   True  False       0
  2000-02-02  False  False   True       0
  2000-02-03   True  False   True       1
  2000-02-04  False  False   True       0
  </code></pre>
  
  <p>Desired results:</p>
  
  <pre><code>                A      B      C  Change
  2000-01-31  False   True   True       1
  2000-02-01  False   True   True       0
  2000-02-02  False   True   True       0
  2000-02-03   True  False   True       1
  2000-02-04   True  False   True       0
  </code></pre>
  
  <p>This is the closest I've been able to get using shift(), but it only persists for one row. I need it to persist for N number of rows. It breaks down in row three (or row 2 with the 0 base) in the example below. </p>
  
  <pre><code>print pandas.DataFrame(numpy.where(pandas.DataFrame(df['Change']==1)
      , df, df.shift()))
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>       0      1      2  3
  0  False   True   True  1
  1  False   True   True  1
  2  False   True  False  0
  3   True  False   True  1
  4   True  False   True  1
  </code></pre>
  
  <p>Thank you.</p>