I have the below 2 dataframes
Dataframe_1
Salesguy | limit |
---|---|
A | 10 |
B | 11 |
C | 0 |
D | 14 |
E | 6 |
There is another dataframe2, which contains some shop details with 10 columns and say 1000 rows. I need to assign the salesguys to the rows in dataframe2 in a new 11th column in round robin manner (ABCDE ABCDE ..so on). But the assignment needs to stop once the corresponding limit (in column 2 of dataframe_1) for the salesguy is reached.
for ex - since limit for C is 0, the assignment should be ABDE ABDE,
after 6 iterations, it will become ABD ABD (as the limit for E after 6 iterations will be 0)
Can anyone please help with the python code for this ?
I am able to assign the salesguys in the round robin manner using a list
l = [A,B,C,D,E]
dataframe_2['New']=''
dataframe_2.loc['New']=l
But I am una开发者_如何学JAVAble to figure how to use the column 2 to set the corresponding limits for each salesguy.
精彩评论