I have a dataset like this:
Id|Sem|Grade|Rating|SUB
1|2|A|3|sub1
1|4|C|1|sub2
2|2|B|2|sub1
I want to form association rules for the above data and recommend sub1,sub2 to students. How do I do it? I tried:
records=[]
for i in range(0,60):
records.append([str(df.values[i,j]) for j in range(0,5)])
from apyori import apriori
assosciation_rules=apriori(records,min_support=0.1)
assosciation_results=list(assosciation_rules)
The output is not understandable.Is there any better way.The output is like this:
[RelationRecord(items=frozenset({'0'}), support=0.3333333333333333, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'0'}), confidence=0.3333333333333333, lift=1.0)]),....
Try
for i in range(0,60):
records.append([df.columns[j]+'='+str(df.values[i,j]) for j in range(0,5)])
This will a) increase readability and b) get rid of the error that your code treats all zeros the same (no matter which column they are from)