title: Create a column in pandas dataframe based on 1st row of each group
body: <p>I have a pandas dataframe as below:</p>
  
  <pre><code>import pandas as pd 
  import numpy as np
  import datetime
  
  # intialise data of lists. 
  data = {'A'      :[1,1,1,1,2,2,2,2],
          'B'     :[440,365,365,130,430,360,355,120]} 
  
  # Create DataFrame 
  df = pd.DataFrame(data) 
  
  
      A   B
  0   1   440
  1   1   365
  2   1   365
  3   1   130
  4   2   430
  5   2   360
  6   2   355
  7   2   120
  </code></pre>
  
  <p>I want to create a column 'C' ans set it to 1 for first row of each group based on column 'A'.</p>
  
  <p>Expected output:</p>
  
  <pre><code>    A   B     C
  0   1   440   1
  1   1   365   
  2   1   365
  3   1   130
  4   2   430   1
  5   2   360
  6   2   355
  7   2   120
  </code></pre>