title: How to count value change during a for loop in python?
body: <p>I have a dataframe that consists of one column that consists of <code>0</code> and <code>1</code>.</p>
  <p>They are structured in this way <code>[0,0,1,1,0,0,1,1,1,]</code>.</p>
  <p>My goal is to count only the first <code>1</code> in each repeating <code>1</code>s in a loop.</p>
  <p>So in this example of <code>[0,0,1,1,0,0,1,1,1,]</code> it should be able to only count a total of <code>2</code>. How can I use a for loop and use an <code>if</code> condition and count this?</p>