title: Transform a dataframe using pivot
body: <p>I am trying to transform a dataframe using <code>pivot</code>. Since the column contains duplicate entries, i tried to add a <code>count</code> column following what's suggested <a href="https://stackoverflow.com/a/47152692/8281509">here</a> (Question 10 posted in this answer).</p>
  <pre><code>import pandas as pd
  from pprint import pprint
  
  
  if __name__ == '__main__':
      d = {
          't': [0, 1, 2, 0, 1, 2, 0, 2, 0, 1],
          'input': [2, 2, 2, 2, 2, 2, 4, 4, 4, 4],
          'type': ['A', 'A', 'A', 'B', 'B', 'B', 'A', 'A', 'B', 'B'],
          'value': [0.1, 0.2, 0.3, 1, 2, 3, 1, 2, 1, 1],
      }
      df = pd.DataFrame(d)
      df = df.drop('t', axis=1)
      df.insert(0, 'count', df.groupby('input').cumcount())
      pd.pivot(df, index='count', columns='type', values='value')
  </code></pre>
  <p>But I still get the same error <code>    raise ValueError(&quot;Index contains duplicate entries, cannot reshape&quot;) ValueError: Index contains duplicate entries, cannot reshape</code>.</p>
  <p>Could someone please suggest how to resolve this error?</p>