title: Pandas dataframe doesn't update column value under condition
body: <p>Originally I have a dataframe (along with other columns, but the information is not relevant here)</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>index</th>
  <th>DNA</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0</td>
  <td>0</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>2</td>
  <td>-1</td>
  </tr>
  <tr>
  <td>3</td>
  <td>0</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I added an additional boolean column called consec_bs in my dataframe. I defined consec_bs as such: if the absolute value of the <code>df['DNA'] - df['DNA'].shift()</code> equals 2, consec_bs is True. Otherwise it's false. <code>df['DNA']</code> only takes values -1, 0, or 1. My code is as following:</p>
  <pre><code>def consec_bs(df):
      df['consec_bs'] = False
      temp = df.shift()
      df['diff'] = abs(df['DNA'] - temp['DNA'])
      df[df['diff'] == 2].loc['consec_bs'] = True
              
      return df
  </code></pre>
  <p>And the output df is</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>index</th>
  <th>DNA</th>
  <th>consec_bs</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0</td>
  <td>0</td>
  <td>False</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>False</td>
  </tr>
  <tr>
  <td>2</td>
  <td>-1</td>
  <td>False</td>
  </tr>
  <tr>
  <td>3</td>
  <td>0</td>
  <td>False</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>However, consec_bs should return true at index 2.
  I've tried <code>df[df['diff'] == 2]['consec_bs'].replace(False, True, inplace = True)</code>, but it doesn't update consec_bs.</p>