title: Cumulative concatenation from last to first within a group in Python
body: <p>I'm looking to concatenate in cumulative manner values within a column in a data frame. However, the column will be partitioned/grouped by the values in another column.</p>
  <p>I have been able to do this from the top down with the following code:</p>
  <pre><code>df['Col_to_cum_Concat']=[y.CUM_CONCAT_TOP.tolist()[:z+1] for x, y in df.groupby('Group_Col')for z in range(len(y))]
  df['Col_to_cum_Concat'] = df['Col_to_cum_Concat'].astype(str).str.lower()
  </code></pre>
  <p>Is there an easier way to go from last to first row within the group?</p>
  <p>Example:
  <a href="https://i.stack.imgur.com/YRtZo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YRtZo.png" alt="Group_Col Text
  1
  1
  2
  2
  2
  3" /></a></p>
  <p>I have tried the code below but is not exactly working.</p>
  <pre><code>df['Col_to_cum_Concat']=[y.CUM_CONCAT_TOP.tolist()[z:] for x, y in df.groupby('Group_Col')for z in range(len(y))]
  df['Col_to_cum_Concat'] = df['Col_to_cum_Concat'].astype(str).str.lower()
  </code></pre>
  <p>Also, I apologize in advance if this is a dumb question. I'm still a newbie at Python.</p>