title: Add the value of the last row to to this row
body: <p>I want to get the value of the last row when grouping by Name. For instance, the last iteration of the name Walter in row 2, I want to get Dog + ", " + Cat for Col1 and Beer + ", " + Wine in Col3. There are a lot of columns, so I would like to make it based on indexing/column position instead of column names.</p>
  
  <pre><code>+------+---------+-------+
  | Col1 |  Name   | Col3  |
  +------+---------+-------+
  | Dog  | Walter  | Beer  |
  | Cat  | Walter  | Wine  |
  | Dog  | Alfonso | Cider |
  | Dog  | Alfonso | Cider |
  | Dog  | Alfonso | Vodka |
  +------+---------+-------+
  </code></pre>
  
  <p>This is the output I want:</p>
  
  <pre><code>+---------------+---------------------------+---------------------+
  |     Col1      |           Name            |        Col3         |
  +---------------+---------------------------+---------------------+
  | Dog           | Walter                    | Beer                |
  | Dog, Cat      | Walter, Walter            | Beer, Wine          |
  | Dog           | Alfonso                   | Cider               |
  | Dog, Dog      | Alfonso, Alfonso          | Cider, Cider        |
  | Dog, Dog, Dog | Alfonso, Alfonso, Alfosno | Cider, Cider, Vodka |
  +---------------+---------------------------+---------------------+
  </code></pre>
  
  <p>This is what I have tried (but does not work):</p>
  
  <pre><code>for i in df:
      if df.loc[i,1] == df.loc[i+1,1]:
          df.loc[i,0] + ", " + df.loc[i+1,0]
      else:
          df.loc[i+1,0]
  </code></pre>
  
  <p>I read that iterating over rows in pandas with a for-loop is frowned upon, so I would like to get the output by using vectorization or apply (or some other efficient way).</p>