Esempio n. 1
0
def calculateTurn(inventory):
    '''


    Parameters
    ----------
    inventory : TYPE list
        DESCRIPTION. list of inventory values

    Returns
    -------
    turn : TYPE float
        DESCRIPTION. daily TURN index

    '''
    #define inventory from movements
    movements = movementfunctionfromInventory(inventory)
    movements = movements.dropna()

    #calculate the average outbound quantity per day
    out_qty_day = -np.sum(
        movements[movements['QUANTITY'] < 0]['QUANTITY']) / len(movements)

    #calculate average inventory quantity
    I_t_avg = np.nanmean(inventory)
    if I_t_avg > 0:
        turn = out_qty_day / I_t_avg
    else:
        turn = np.nan

    return turn
Esempio n. 2
0
def calculateCOI(inventory):
    '''


    Parameters
    ----------
    inventory : TYPE list
        DESCRIPTION. list of inventory values

    Returns
    -------
    COI_in : TYPE float
        DESCRIPTION. daily COI index IN
    COI_out : TYPE float
        DESCRIPTION. daily COI index OUT

    '''

    #define inventory from movements
    movements = movementfunctionfromInventory(inventory)
    movements = movements.dropna()
    pop_in, pop_out, _, _ = calculatePopularity(movements['QUANTITY'])

    #calculate daily COI
    I_t_avg = np.nanmean(inventory)
    if I_t_avg > 0:
        COI_in = pop_in / I_t_avg
        COI_out = pop_out / I_t_avg
    else:
        COI_in = COI_out = np.nan

    return COI_in, COI_out
Esempio n. 3
0
def updateTURN(D_SKUs):

    #create result columns
    D_SKUs['TURN'] = np.nan

    for index, row in D_SKUs.iterrows():
        #select inventory curve
        I_t = D_SKUs.loc[index]['INVENTORY_QTY']
        #calculate the popularity
        movements = movementfunctionfromInventory(I_t)
        movements = movements.dropna()
        if len(movements) > 0:
            TURN = calculateTurn(I_t)

            #update the dataframe
            D_SKUs.at[index, 'TURN'] = TURN

    return D_SKUs
Esempio n. 4
0
def updateFourieranalysis(D_SKUs):

    #create result columns
    D_SKUs['FOURIER_CARRIER'] = np.nan
    D_SKUs['FOURIER_PERIOD'] = np.nan

    for index, row in D_SKUs.iterrows():
        #select inventory curve
        I_t = D_SKUs.loc[index]['INVENTORY_QTY']
        #calculate the popularity
        movements = movementfunctionfromInventory(I_t)
        movements = movements.dropna()
        if len(movements) > 0:
            carrier, period = fourierAnalysisInventory(I_t)

            #update the dataframe

            D_SKUs.at[index, 'FOURIER_CARRIER'] = carrier
            D_SKUs.at[index, 'FOURIER_PERIOD'] = period

    return D_SKUs
Esempio n. 5
0
def updatePopularity(D_SKUs):

    #create result columns
    D_SKUs['POP_IN'] = np.nan
    D_SKUs['POP_OUT'] = np.nan
    D_SKUs['POP_IN_TOT'] = np.nan
    D_SKUs['POP_OUT_TOT'] = np.nan

    for index, row in D_SKUs.iterrows():
        #select inventory curve
        I_t = D_SKUs.loc[index]['INVENTORY_QTY']
        #calculate the popularity
        movements = movementfunctionfromInventory(I_t)
        movements = movements.dropna()
        if len(movements) > 0:
            POP_IN, POP_OUT, POP_IN_TOT, POP_OUT_TOT = calculatePopularity(
                movements['QUANTITY'])

            #update the dataframe
            D_SKUs.at[index, 'POP_IN'] = POP_IN
            D_SKUs.at[index, 'POP_OUT'] = POP_OUT
            D_SKUs.at[index, 'POP_IN_TOT'] = POP_IN_TOT
            D_SKUs.at[index, 'POP_OUT_TOT'] = POP_OUT_TOT
    return D_SKUs