I have a table of skus that need to be placed in locations. Based on the volume that a sku has determines how many locations a sku needs. There are a limited number of locations so I need to prioritize based on how much volume will be in a location. Then once in order apply the locations. When the location is full the volume for the location should be the location volume, for the last location the remainder volume. Current table setup
So the end result should look like this.
I was hoping to iterate based on the number of locations needed and create a row in a new table while reducing the number of listed locations by row. Something like this.
rows = int(sum(df['locations_needed']))
new_locs = []
for i in range(rows):
if df['locations_needed'] > 1:
new_locs.append(df['SKU'], df['location_amount'])
df['locations_needed'] - 1
else:
new_locs.append(df['SKU'], df['remainder_volume'])
df['locations_needed'] - 1