Using column name as a new attribute in pandas

Viewed 3206

I have the following data structure

Date         Agric  Food 
01/01/1990    1.3   0.9  
01/02/1990    1.2   0.9 

I would like to covert it into the format

Date        Sector  Beta
01/01/1990  Agric   1.3
01/02/1990  Agric   1.2
01/01/1990  Food    0.9
01/02/1990  Food    0.9

while I am sure I can do this in a complicated way, is there a way of doing this in a few line of code?

3 Answers
Related