title: Pandas Dataframe - Generate incremental values
body: <p>In my workflow there are multiple CSVs with four columns <code>OID, value, count, unique_id</code>. I am trying to figure how to generate incremental values under <code>unique_id</code> column. Using <code>apply()</code>, I can do something like <code>df.apply(lambda x : x + 1) #where x = 0</code> and it will result in all values under <code>unique_id</code> as 1. However, I am confused on how to use <code>apply()</code> to generate incrementally values in each row for a specific column. </p>
  
  <pre><code># Current Dataframe 
     OID  Value  Count  unique_id
  0   -1      1      5          0
  1   -1      2     46          0
  2   -1      3     32          0
  3   -1      4      3          0
  4   -1      5     17          0
  
  # Trying to accomplish
     OID  Value  Count  unique_id
  0   -1      1      5          0
  1   -1      2     46          1
  2   -1      3     32          2
  3   -1      4      3          3
  4   -1      5     17          4
  </code></pre>
  
  <p>Sample code (I understand that the syntax is incorrect, but it is approximately what I am trying to accomplish):</p>
  
  <pre><code>def numbers():
      for index, row in RG_Res_df.iterrows():
          return index
  
  RG_Res_df = RG_Res_df['unique_id'].apply(numbers)
  </code></pre>