title: pandas DataFrame set non-contiguous sections
body: <p>I have a DataFrame like below and would like for B to be 1 for n rows <em>after</em> the 1 in column A (where below n = 2)</p>
  
  <pre><code>index  A   B
  0      0   0
  1      1   0
  2      0   1
  3      0   1
  4      1   0
  5      0   1
  6      0   1
  7      0   0
  8      1   0
  9      0   1
  </code></pre>
  
  <p>I think I can do it using .ix similar to this example but not sure how. I'd like to do it in a single in pandas-style selection command if possible. (Ideally not using rolling_apply.)
  <a href="https://stackoverflow.com/questions/12307099/modifying-a-subset-of-rows-in-a-pandas-dataframe">Modifying a subset of rows in a pandas dataframe</a></p>
  
  <p>EDIT: the application is that the 1 in column A is "ignored" if it falls within n rows of the previous 1. As per the comments, for n = 2 then, and these example: </p>
  
  <p>A = [1, 0, 1, 0, 1], B should be = [0, 1, 1, 0, 0]
  A = [1, 1, 0, 0], B should be [0, 1, 1, 0]</p>