Horje
repeat rows in a pandas dataframe based on column value Code Example
repeat rows in a pandas dataframe based on column value
df.reindex(df.index.repeat(df.persons))
Out[951]: 
   code  .     role ..1  persons
0   123  .  Janitor   .        3
0   123  .  Janitor   .        3
0   123  .  Janitor   .        3
1   123  .  Analyst   .        2
1   123  .  Analyst   .        2
2   321  .   Vallet   .        2
2   321  .   Vallet   .        2
3   321  .  Auditor   .        5
3   321  .  Auditor   .        5
3   321  .  Auditor   .        5
3   321  .  Auditor   .        5
3   321  .  Auditor   .        5




Whatever

Related
aws cli ssm get parameter Code Example aws cli ssm get parameter Code Example
copy content to clipboard windoesa Code Example copy content to clipboard windoesa Code Example
hashmap key check Code Example hashmap key check Code Example
phone number fomart Code Example phone number fomart Code Example
vagrant Code Example vagrant Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6