I have the following df that comprises of code/product & weeks columns.
code. Product . weeks
123 . product1 . 1;2
123 . product1 . 3
321 . product2 . 4;5;6
321 . product2 . 7
For those rows that have more than 1 week (eg 1;2 or 4;5;6), I want to repeat these rows. My Desirsed output is as follows:
code. Product . weeks
123 . product1 . 1
123 . product1 . 2
123 . product1 . 3
321 . product2 . 4
321 . product2 . 5
321 . product2 . 6
321 . product2 . 7
What is the best approach to take using pandas or numpy?