title: Subset permutation of one column based on the category of another column in pandas
body: <p>Here is one simplified case:</p>
  <pre><code>df = pd.DataFrame({'col1': [1, 1, 1, 2, 2, 2, 3, 3, 3], 'col2': ['a', 'b', 'c', 'A', 'C', 'B', 'red', 'blue', 'greed']})
  </code></pre>
  <p>I want to do subset permutation on col2 with reference to col1. For example, only permute 'a', 'b', 'c' in col2 for they belong to category 1 in col1. And permute 'A', 'C', 'B' in category 2, then those colors in category 3. The output looks like below:</p>
  <pre><code>col1    col2
  0   1   b
  1   1   c
  2   1   a
  3   2   A
  4   2   B
  5   2   C
  6   3   blue
  7   3   red
  8   3   green
  </code></pre>
  <p>For there are thousands of categories in col1, I'm thinking if there is a simple way instead of doing it in a loop one by one. Thank you.</p>