I have a custom function,
def SafetyStockLevel(inputpartnumber): safetystock=0 LastYear=np.max(df.ACTUAL_GI_YEAR) fifthLastYear=LastYear-4 lasttwoYear=LastYea