title: Python pandas how to add an accumulation counter to a neighboring column?
body: <p>I have a csv file with something like this column</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Comulative</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">-1</td>
  </tr>
  <tr>
  <td style="text-align: left;">-3</td>
  </tr>
  <tr>
  <td style="text-align: left;">-4</td>
  </tr>
  <tr>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  </tr>
  <tr>
  <td style="text-align: left;">-1</td>
  </tr>
  <tr>
  <td style="text-align: left;">-4</td>
  </tr>
  <tr>
  <td style="text-align: left;">-8</td>
  </tr>
  <tr>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  </tr>
  <tr>
  <td style="text-align: left;">10</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like to add an internal column counting the number of sign shifts</p>
  <p>To get something like this</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Comulative</th>
  <th style="text-align: left;">Score</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">-1</td>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">-3</td>
  <td style="text-align: left;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">-4</td>
  <td style="text-align: left;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: left;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: left;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">-1</td>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">-4</td>
  <td style="text-align: left;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">-8</td>
  <td style="text-align: left;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: left;">1</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: left;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: left;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">10</td>
  <td style="text-align: left;">4</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>In my original csv file, the Comulative column usually does not change the sign from about 100 to 500 lines here , for clarity , it changes so often !</p>
  <p>Can you tell me how to do it better ?</p>