I want to turn column into a new rows and save the values.
For example:
BEFORE
NAME COMDEDY HORROR ROMANCE
brian 10 20 14
tom 20 10 11
AFTER
NAME GANRE RATING
brian comedy 10
brian horror 20
brian romance 14
tom comedy 20
tom horror 10
tom romance 11
I need to do this at least with python pandas ,if I can't do it with prestodb
You can do it using presto sql:
SELECT t1.name, t2.genre, t2.rating
FROM table t1
CROSS JOIN unnest (
array['comedy', 'horror', 'romance'],
array[comedy, horror, romance]
) t2 (genre, rating)