TLDR: How to find all (n_results) subsets of a_list with a given length of n_values in the range of n_values_delta, which sum_n_values equals a target_value in the range of target_value_delta. The index at which the n_values of each subset have been found in a_list is also needed.
a_list = pd.Series()
n_values_delta = upper and lower limit for every value in a subset.
sum_n_values = target_value b
target_values_delta = upper and lower limit to approximately match the target value.
index = the index where the values of a subset have been found in a_list.
n_results = max amount of subsets to find.
def get_matches(a_list, n_values_delta, target_values_delta, target_value, n_results)
some function....
return a list of subsets as dictonarys which keys represent the index where the subsets values habe been found in a_list.
Ideally the returned dictionary's are ordered by the sum_n_values matching accuracy to the target_value.
The bigger picture:
I want to build a program that suggest non recurring daily recipe combinations for individuals bases on daily higher and lower limits for eg. calories_intake, fat_intake, sugar_intake, ....
nutrient_values is a data-frame that holds the nutrient index per recipe. recipes is a data-frame that holds the title, cooking time, instructions, ...
My current data structure:
print(nutrients_values.columns)
Index(['calories', 'fatContent', 'saturatedFatContent', 'carbohydrateContent',
'sugarContent', 'proteinContent', 'sodiumContent', 'servingSize'],
dtype='object')
print(recipes.columns)
Index(['title', 'total_time', 'yields', 'ingredients', 'instructions', 'image',
'nutrients'],
dtype='object')