title: Pandas assigning random string to each group as new column
body: <p>We have a dataframe like</p>
  
  <pre><code>Out[90]: 
     customer_id                 created_at
  0     11492288 2017-03-15 10:20:18.280437
  1      8953727 2017-03-16 12:51:00.145629
  2     11492288 2017-03-15 10:20:18.284974
  3     11473213 2017-03-09 14:15:22.712369
  4      9526296 2017-03-14 18:56:04.665410
  5      9526296 2017-03-14 18:56:04.662082
  </code></pre>
  
  <p>I would like to create new column here, based on groups of customer_id, random strings of 8 characters assigned to each group.</p>
  
  <p>For example the output would then look like</p>
  
  <pre><code>Out[90]: 
     customer_id                 created_at     code
  0     11492288 2017-03-15 10:20:18.280437 nKAILfyV
  1      8953727 2017-03-16 12:51:00.145629 785Vsw0b
  2     11492288 2017-03-15 10:20:18.284974 nKAILfyV
  3     11473213 2017-03-09 14:15:22.712369 dk6JXq3u
  4      9526296 2017-03-14 18:56:04.665410 1WESdAsD
  5      9526296 2017-03-14 18:56:04.662082 1WESdAsD
  </code></pre>
  
  <p>I am used to R and dplyr, and it is super easy to write this transformation using them. I am looking for something similar in Pandas to this:</p>
  
  <pre><code>library(dplyr)
  library(stringi)
  
  df %&gt;%
    group_by(customer_id) %&gt;%
    mutate(code = stri_rand_strings(1, 8))
  </code></pre>
  
  <p>I can figure out the random character part. Just curious on how Pandas groupby works in this case.</p>
  
  <p>Thanks!</p>