'Duplicate rows in CSV file n times based on value of column
I have a CSV file that has the following data structure -

I want to repeat duplicate the rows the number of times the value of row 'repeat' is. So, for the Frame# 4- I want to repeat the whole row 2 times.
Input -
Frame# Yaw Pitch Roll KeyCode EyeX EyeY Repeat
1 13.116 -13.601 -16.871 - 480.86 175.24 1
2 13.553 -14.146 -17.872 - 469.12 161.7 1
3 13.885 -14.621 -18.694 - 465.38 161.75 1
4 13.425 -14.674 -18.614 - 465.67 154.52 2
5 13.153 -14.539 -18.069 - 457.33 136.78 3
Output -
Frame# Yaw Pitch Roll KeyCode EyeX EyeY Repeat
1 13.116 -13.601 -16.871 - 480.86 175.24 1
2 13.553 -14.146 -17.872 - 469.12 161.7 1
3 13.885 -14.621 -18.694 - 465.38 161.75 1
4 13.425 -14.674 -18.614 - 465.67 154.52 2
4 13.425 -14.674 -18.614 - 465.67 154.52 2
5 13.153 -14.539 -18.069 - 457.33 136.78 3
5 13.153 -14.539 -18.069 - 457.33 136.78 3
5 13.153 -14.539 -18.069 - 457.33 136.78 3
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
