I know that typically replication of rows is horrible for performance, which is why most answers on Stackoverflow don't explain how to actually do it but suggest better alternatives - but for my use case, I need to actually do that.
I have a table with replication weights,
   id   some_value weight
    1            2      5
    2            A      2
    3            B      1
    4            3      3
where I need to repeat each row by the weight value. Think of a huge data frame. What would be a very efficient way to achieve this?
Expected output:
   id   some_value weight
    1            2      5
    1            2      5
    1            2      5
    1            2      5
    1            2      5
    2            A      2
    2            A      2
    3            B      1
    4            3      3
    4            3      3
    4            3      3
 
     
     
    