Manipulating data - rows into columns
I have a set of data which looks like this:
Property Name 1 | Attribute type 1 | Attribute 1
Property Name 1 | Attribute type 2 | Attribute 2
Property Name 1 | Attribute type 3 | Attribute 3
Property Name 1 | Attribute type 4 | Attribute 4
Property Name 2 | Attribute type 2 | Attribute 2
Property Name 2 | Attribute type 4 | Attribute 4
Property Name 2 | Attribute type 1 | Attribute 1
Property Name 2 | Attribute type 5 | Attribute 5
Property Name 2 | Attribute type 6 | Attribute 6
Let me just explain it so it makes more sense. Basically the attribute types is stuff such property desc, price, no of bedrooms, no of bathrooms, availability, and so on. The attributes is the data so for example it would be stuff such as
bedrooms : 1
bathrooms: 1
availability : June 2015
price : 500 per month
etc
The order of the attributes is not consistent so for each property they are jumbled. Also not every property has every attribute type - some have more, others less.
So in the example above you can see property name 1 has less attributes that property type 2. You will also notice the different order too.
I would like it to look like this:
Property | Attribute type 1 | Attribute type 2 | Attribute type 3 | Attribute type 4 | Attribute type 5 | Attribute type 6 |
Property Name 1 | Attribute 1 | Attribute 2 | Attribute 3 | Attribute 4 | - | - |
Property Name 2 | Attribute 1 | Attribute 2 | - | Attribute 4 | Attribute 5 | Attribute 6 |
So as you can see the column order is consistent for each attribute type with the data appearing in the column, if it exists. If it doesn't exist the column would be empty for that property name.
Any ideas on how I could go about doing this?
please share the sample data
please share the sample data