-
Beta Was this translation helpful? Give feedback.
Answered by
rasbt
May 1, 2022
Replies: 2 comments
-
I think the problem could be that the inputs were not lists. The dataset should be in the following form dataset = [['Milk', 'Onion', 'Nutmeg', 'Kidney Beans', 'Eggs', 'Yogurt'],
['Dill', 'Onion', 'Nutmeg', 'Kidney Beans', 'Eggs', 'Yogurt'],
['Milk', 'Apple', 'Kidney Beans', 'Eggs'],
['Milk', 'Unicorn', 'Corn', 'Kidney Beans', 'Yogurt'],
['Corn', 'Onion', 'Onion', 'Kidney Beans', 'Ice cream', 'Eggs']]
import pandas as pd
from mlxtend.preprocessing import TransactionEncoder
te = TransactionEncoder()
te_ary = te.fit(dataset).transform(dataset)
df = pd.DataFrame(te_ary, columns=te.columns_) If you don't use sublists, I think that problems that you are showing can happen. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mingrich
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the problem could be that the inputs were not lists.
The dataset should be in the following form
If you don't use sublists, I think that problems that yo…