| A | B | C | D | E | |
|---|---|---|---|---|---|
| Key 1 | 1 | -1 | |||
| Key 2 | 1 | -1 | |||
| Key 3 | 1 | -1 | |||
| Key 4 | -1 | 1 | |||
| Key 5 | 1 | -1 | |||
| Key 6 | 1 | -1 | |||
| Key 7 | 1 | -1 | |||
| Key 8 | 1 | -2 | 1 |
Final Result
| A | B | C | D | E |
|---|---|---|---|---|
| 1 | -1 |
suppose we have the above dataframe where each key is an option used to create a combination to get to the desired Final Result. Suppose that you can also specify max number of combinations it can use to achieve the final result below, how would one iterate through the dataframe and when a set of combinations equals the final result, it prints all the keys that make up the combo as well as number of combos it took?
For example, let's say the maximum number of combinations is 3-key combo. Then the following combinations will satisfy both the Final Result and stay under or equal to the number of key combos allowed to achieve it
Key 2 (itself), combos 1
Key 4 + Key 5, combos 2
Key 3 + Key 8, combos 2