title: Assigning random value for categories in pandas
body: <p>I have a <code>df</code></p>
  <pre><code>Name        Week
  Google      1
  Google      1
  Amazon      1
  Tesla       1
  Tesla       1
  Google      2
  Google      2
  Tesla       2
  Tesla       2
  Uber        3
  Uber        3
  </code></pre>
  <p>I am trying to create a new column <code>value</code> which would be a random integer between <code>x</code> an <code>y</code> for combinations of <code>Name</code> and <code>Week</code> like so:</p>
  <pre><code>Name        Week        Value
  Google      1           100
  Google      1           100
  Amazon      1           150
  Tesla       1           170
  Tesla       1           170
  Google      2           250
  Google      2           250
  Tesla       2           157
  Tesla       2           157
  Uber        3           500
  Uber        3           500
  </code></pre>
  <p>Where the same value is assigned for the combination of <code>Name</code> and <code>Week</code>.</p>
  <p>I tried:</p>
  <pre><code>def random_group_int(df_):
      
      week = df_.week_no
      supplier = df_.sm_supp_name
  
      combinations = list(itertools.combinations(df.Week.unique(), df.Name.unique()))
  
      rand_values_dict_by_combination = {combination: np.random.randint(100,200) for combination in combinations}
  
      # return value by the combination on the line
      # don't know how to do that
  
  </code></pre>
  <p>And I feel like this is not the best approach. I also tried:</p>
  <pre><code>df_rand = df.groupby(['Name','Week']).count()
  df_rand['Value'] = df_rand['Week'].apply(lambda x : np.random.randint(100,200))
  df_rand.reset_index(inplace = True)
  df.merge(df_rand[['Value', 'Name', 'Week']], left_on = ['Name', 'Week'], right_on = ['Name', 'Week'], how = 'left')
  </code></pre>
  <p>Which does work but again, I am not sure if that's the approach I should be using.</p>