title: Transposing data to become a column
body: <p>I have a Pandas dataframe which looks like this:</p>
  <pre><code>|   | x_id | x_name | has_policy | payment_name | count |
  |---|------|--------|------------|--------------|-------|
  | 0 | 2    | two    | 0          | Hybrid       | 58    |
  | 1 | 2    | two    | 1          | Hybrid       | 2     |
  | 2 | 5    | five   | 1          | Excl         | 13    |
  | 3 | 5    | five   | 0          | Excl         | 70    |
  | 4 | 5    | five   | 0          | Agen         | 811   |
  | 5 | 5    | five   | 1          | Agen         | 279   |
  | 6 | 5    | five   | 1          | Hybrid       | 600   |
  | 7 | 5    | five   | 0          | Hybrid       | 2819  |
  </code></pre>
  <p>I would like to have the combination of <code>has_policy</code> and <code>payment_name</code> to become a column, with the respective <code>count</code>. Expected output would look like this:</p>
  <pre><code>| id | name | no_policy_hybrid | no_policy_excl | no_policy_agen | policy_hybrid | policy_excl | policy_agen |
  |----|------|------------------|----------------|----------------|---------------|-------------|-------------|
  | 2  | two  | 58               | 0              | 0              | 2             | 0           | 0           |
  | 5  | five | 2819             | 70             | 811            | 600           | 13          | 279         |
  </code></pre>
  <p>I was looking at the documentation for both <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.transpose.html" rel="nofollow noreferrer">transpose</a> and <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pivot.html" rel="nofollow noreferrer">pivot</a> and I'm unsure which would be best to use, though I feel transpose does make more sense for this use case since the count column is already an aggregation.</p>