0

I have an excel table that is something like this:

Clothes cost

colour      type    small   medium  large
red         polo    £2      £4      £6 
blue        shorts  £5      £10     £15

But want something like this:

colour  type    size    cost
red     polo    small   £2 
red     polo    medium  £4 
red     polo    large   £6
blue    shorts  small   £5
blue    shorts  medium  £10
blue    shorts  large   £15

I am using pandas, which I am relatively new to, and have tried to create two dataframes and then somehow merge them. I have looked at the transpose and iloc methods, but havent had much luck. I want the resultant table to be a dataframe.

Is this actually possible?

Many thanks

sobmortin
  • 17
  • 3

0 Answers0