Transforming Pandas dataframe Transforming Pandas dataframe pandas pandas

Transforming Pandas dataframe


You can use the pivot function:

df.pivot(index='date', columns='variable', values='value')

For more info see: http://pandas.pydata.org/pandas-docs/stable/reshaping.html