Hi all,
I have not coded for a while and am still getting used to all the new fangled data types :)
I am taking a course in Database mining and we have been set a first problem of mining frequent patterns using the apriori algorithm. Now I have a pretty solid understanding of the logic but I when I am trying to print because of the way I have my data represented I can't figure out how to do it the way I would like. I am able to get through the first pass where I end up with a list of 1 item sets and a related value in another list. so the data looks like this candidates({book},{pencil}, {School bag},...) and I am able to iterate through it quite simply by doing this:
I have not coded for a while and am still getting used to all the new fangled data types :)
I am taking a course in Database mining and we have been set a first problem of mining frequent patterns using the apriori algorithm. Now I have a pretty solid understanding of the logic but I when I am trying to print because of the way I have my data represented I can't figure out how to do it the way I would like. I am able to get through the first pass where I end up with a list of 1 item sets and a related value in another list. so the data looks like this candidates({book},{pencil}, {School bag},...) and I am able to iterate through it quite simply by doing this:
for x in candidates: for y in x: print(y ))I do this because I do not wan the curly braces printed do I dereference he set element. Now on the second pass I have a list of sets containing two elements candidates({book, pencil},{book, school bag}, {pencil, School bag},...) and I would like to print it the same way with both set elements on one line. I have tried this but, no luck
for x in candidates: for y,z in x: print(y + " , " + z))Thanks for any pointers