Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas repeat rows n times

test.loc[test.index.repeat(test.times)]

  id  times
0  a      2
0  a      2
1  b      3
1  b      3
1  b      3
2  c      1
3  d      5
3  d      5
3  d      5
3  d      5
3  d      5
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #repeat #rows #times
ADD COMMENT
Topic
Name
3+5 =