Hello all, I have a dataset of 150 people. I’m trying to develop a simple rules based algorithm in Python which will match these people into groups of 3 based on the rules below:
- Same gender (male or female)
- Similar age (plus or minus 5 years)
- Same favourite colour
- Same favourite food
- Same favourite country
The algorithm should group people into 2 if there is not enough data for a 3rd person. When data is added and the algorithm is executed again the 3rd person should be added to that group.
Any help would be much appreciated!