My input dataframe looks like this:
Variable | fiscal_week_id | units
xxxxxxxxxxx | 201801 | xx_unit_201801
xxxxxxxxxxx | 201802 | xx_unit_201802
xxxxxxxxxxx | 201803 | xx_unit_201803
yyyyyyyyyyy | 201801 | yy_unit_201801
yyyyyyyyyyy | 201802 | yy_unit_201802
yyyyyyyyyyy | 201803 | yy_unit_201803
Need output like this:
Variable | 201801 | 201802 | 201803
xxxxxxxxxxx | xx_unit_201801 | xx_unit_201802 | xx_unit_201803
yyyyyyyyyyy | yy_unit_201801 | yy_unit_201802 | yy_unit_201803
Any help please, new to pandas and need solution in pandas only. I tried out with set_index
, but didn't seem to work out.