title: Pandas DataFrame Groupby to get Unique row condition and identify with increasing value up to Number of Groups
body: <p>I have a <code>DataFrame</code> where a combination of column values identify a unique address (A,B,C).  I would like to identify all such rows and assign them a unique identifier that I increment per address.</p>
  
  <p>For example</p>
  
  <pre><code>A B C D E
  0 1 1 0 1
  0 1 2 0 1
  0 1 1 1 1
  0 1 3 0 1
  0 1 2 1 0
  0 1 1 2 1
  </code></pre>
  
  <p>I would like to generate the following</p>
  
  <pre><code>A B C D E  ID
  0 1 1 0 1  0
  0 1 2 0 1  1
  0 1 1 1 1  0
  0 1 3 0 1  2
  0 1 2 1 0  1
  0 1 1 2 1  0
  </code></pre>
  
  <p>I tried the following:</p>
  
  <pre><code>id = 0
  def set_id(df):
      global id
      df['ID'] = id
      id += 1
  
  
  df.groupby(['A','B','C']).transform(set_id)
  </code></pre>
  
  <p>This returns a NULL dataframe...This is definitely not the way to do it..I am new to pandas.  The above should actually use <code>df[['A','B','C']].drop_duplicates()</code> to get all unique values
  Thank you.</p>