I have a dataframe like:
id | item_1 | item_2 | item_3 | price_1 | price_2 | price_3 | note |
---|---|---|---|---|---|---|---|
user1 | apple | orange | water | 2.00 | 1.50 | 0.80 | nothing |
user2 | banana | milk | apple | 0.50 | 3.50 | 2.00 | 1 bag |
and I want to make it into something like:
id | item | price | note | number |
---|---|---|---|---|
user1 | apple | 2.00 | nothing | 1 |
user1 | orange | 1.50 | nothing | 2 |
user1 | water | 0.80 | nothing | 3 |
user2 | banana | 0.50 | 1 bag | 1 |
user2 | milk | 3.50 | 1 bag | 2 |
user2 | apple | 2.00 | 1 bag | 3 |
Is it possible to do it without having to manually input those "item_"s and "price_" (since there will be quite a few of them)?