I've cut up an ugly csv file to a reasonable form. I'm left with a row of values in the dataframe that I need to apply to other columns.
Each region (NA, SA, Eur) has different sectors (energy, food, etc) that have market values (1,2,3...etc). I want to group the market values to the sectors and repeat them through.
Right now it looks like:
'Left over header to be discarded' | Market | 1 | 2 | 3 |....
North America | Energy | valueenergy1 | valueenergy2 | valueenergy3 |...
North America | Food | valuefood1 | valuefood2 | valuefood3 |...
North America | Shelter | .
South America | Energy | .
South America | Food | .
Europe | Energy | valueenergy1 |..
Europe | Food | valuefood1 |..
Europe | Shelter | valueshelter1 |..
.
.
I've stored the row as a list with .values.tolist() and removed it from the dataframe to apply it; I'm just not sure how to apply it. I want to have an output that looks like:
North America | 1 | Energy | valueenergy1 |
South America | 1 | Energy | valueenergy1 |
Europe | 1 | Energy | valueenergy1 |
.
.
North America | 2 | Food | valuefood2 |
South America | 2 | Food | valuefood2 |
Europe | 2 | Energy | valueenergy2 |
.
.
North America | 3 | Food | valuefood3 |
South America | 3 | Food | valuefood3 |
Europe | 3 | Shelter | valuehelter3 |