I have a dataset which is in the following form:
Measure_name name Measure_value
housing_price Bob 380000
housing_price Alice 270000
housing_price Dave 140000
Salary Bob 30000
Salary Alice 40000
Salary Dave 35000
Family_members Bob 2
Family_members Alice 4
Family_members Dave 1
I am trying to convert in the following form using python and pandas:
name housing_price Salary Family_members
Bob 380000 30000 2
Alice 270000 40000 4
Dave 140000 35000 1
I searched a lot and tried pandas.pivot_table() but couldn't figure it out as it was giving weird results of all sorts and documentation wasn't clear at all. I tried:
dataset.pivot_table( columns=['Measure_name'], values = 'Measure_values')
But it just gives out a single row output.
Can someone please tell me the correct way to do it? Thank you so much for your help. I am very grateful.