In [13]:
tem={"date":['2010-1-30','2010-1-30','2002-2-2','2002-2-2','2002-2-2'],"element":['tmax','tmin','tmax','tmin','tmin'],"value":[22,21,0,23,32]}
df=pd.DataFrame(tem)
df
Out[13]:
date element value
0 2010-1-30 tmax 22
1 2010-1-30 tmin 21
2 2002-2-2 tmax 0
3 2002-2-2 tmin 23
4 2002-2-2 tmin 32
In [14]:
df.pivot(index='date',columns='element')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-14-c7d62d642522> in <module>()
----> 1 df.pivot(index='date',columns='element')

G:\anaconda\ana\lib\site-packages\pandas\core\frame.py in pivot(self, index, columns, values)
   5189         """
   5190         from pandas.core.reshape.reshape import pivot
-> 5191         return pivot(self, index=index, columns=columns, values=values)
   5192 
   5193     _shared_docs['pivot_table'] = """

G:\anaconda\ana\lib\site-packages\pandas\core\reshape\reshape.py in pivot(self, index, columns, values)
    407             indexed = self._constructor_sliced(self[values].values,
    408                                                index=index)
--> 409     return indexed.unstack(columns)
    410 
    411 

G:\anaconda\ana\lib\site-packages\pandas\core\frame.py in unstack(self, level, fill_value)
   5529         """
   5530         from pandas.core.reshape.reshape import unstack
-> 5531         return unstack(self, level, fill_value)
   5532 
   5533     _shared_docs['melt'] = ("""

G:\anaconda\ana\lib\site-packages\pandas\core\reshape\reshape.py in unstack(obj, level, fill_value)
    487     if isinstance(obj, DataFrame):
    488         if isinstance(obj.index, MultiIndex):
--> 489             return _unstack_frame(obj, level, fill_value=fill_value)
    490         else:
    491             return obj.T.stack(dropna=False)

G:\anaconda\ana\lib\site-packages\pandas\core\reshape\reshape.py in _unstack_frame(obj, level, fill_value)
    507                                value_columns=obj.columns,
    508                                fill_value=fill_value,
--> 509                                constructor=obj._constructor)
    510         return unstacker.get_result()
    511 

G:\anaconda\ana\lib\site-packages\pandas\core\reshape\reshape.py in __init__(self, values, index, level, value_columns, fill_value, constructor)
    129 
    130         self._make_sorted_values_labels()
--> 131         self._make_selectors()
    132 
    133     def _make_sorted_values_labels(self):

G:\anaconda\ana\lib\site-packages\pandas\core\reshape\reshape.py in _make_selectors(self)
    167 
    168         if mask.sum() < len(self.index):
--> 169             raise ValueError('Index contains duplicate entries, '
    170                              'cannot reshape')
    171 

ValueError: Index contains duplicate entries, cannot reshape