title: Pandas filldown by other column (I don't know how to name this)
body: <p>I have a pandas data-frame with a column that indicates if the terms of an account were changed during a particular period with a value of "Y".
  Here is an example:</p>
  
  <pre><code>import pandas as pd
  account = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3]
  period = [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 1, 2, 3]
  changed = ["N", "N", "N", "Y", "N", "N", "N", "Y", "N", "N", "N", "N", "N", "N"]
  
  df = pd.DataFrame({'account': account,'period': period,'changed': changed})
  
  print(df)
      account period changed
  0    1       1       N
  1    1       2       N
  2    1       3       N
  3    1       4       Y
  4    1       5       N
  5    1       6       N
  6    2       1       N
  7    2       2       Y
  8    2       3       N
  9    2       4       N
  10   2       5       N
  11   3       1       N
  12   3       2       N
  13   3       3       N
  </code></pre>
  
  <p>I want to turn the changed column into a switch that once turns on, stays on for that account.  I also want the switch to be converted into 0's and 1's as shown below.</p>
  
  <p>Is there a way to do this without looping through each account.  I have millions of accounts.</p>
  
  <pre><code>    account period  changed
  0    1       1        0
  1    1       2        0
  2    1       3        0
  3    1       4        1
  4    1       5        1
  5    1       6        1
  6    2       1        0
  7    2       2        1
  8    2       3        1
  9    2       4        1
  10   2       5        1
  11   3       1        0
  12   3       2        0
  13   3       3        0
  </code></pre>