0

I have a dataframe with 3 columns. The columns have non unique values but the entire row is unique.

+------------------------------+
|    ID      TYPE   Value      |
+------------------------------+
| 0  u1234      Beds    12.0   |
| 1  u1234    Floors     2.0   |
| 2  u1111      Beds    30.0   |
| 3  u1111    Floors    10.0   |
| 4  u1111  LandArea  1000.23  |
| 5  u1000      Beds     3.0   |
| 6  u1000     Power    240/24 |
| 7  u1555     Power    330/33 |
+------------------------------+

I want to reshape the column as such

+----------------------------------------------+
|       ID     Beds  Floors  LandArea   Power  |        
+-----------------------------------------------
| 0    u1234  12    2         0         0      |
| 1    u1111  30    10     1000.23      0      |         
| 2    u1000  3     0        0          240/24 |
| 3    u1555  0     0        0          330/33 | 
+----------------------------------------------+

I am unable to do the same with pivot table as the value column contains non numeric values.
Riya Gupta
  • 69
  • 8

0 Answers0