I'm not sure how to word this.
I have a situation where I have daily quantities that I need to evenly split into 3 different shifts.
Example
Original DataFrame
product# | day | quantity |
---|---|---|
1 | Jan 1 | 30 |
1 | Jan 2 | 30 |
2 | Jan 2 | 60 |
Desired Result Data Frame
product# | day | quantity | shift |
---|---|---|---|
1 | Jan 1 | 10 | 1 |
1 | Jan 1 | 10 | 2 |
1 | Jan 1 | 10 | 3 |
2 | Jan 2 | 20 | 1 |
2 | Jan 2 | 20 | 2 |
2 | Jan 2 | 20 | 3 |
I have a working version that is just the easy pd.iterrows() version but i'm wondering if its possible to do it via the explode function or something like you can with strings here. How to separate string into multiple rows in Pandas
edit: The table markdown is working on preview but on on result :/