خرید بک لینک

Vote count: 0

I would really appreciate some help.

i'm having problem with an output from pymining / itemmining which creates association rules from transaction baskets. The output (rules) i'm getting is a list like this:

[(frozenset({'A', 'B', 'C', 'D', 'E'}), frozenset({'X'}), 55, 0.8870967741935484), (frozenset({'U', 'Z', 'D'}), frozenset({'G', 'Q'}), 55, 0.5445544554455446),...]

which means if a customer has bought items A B C D E he is likely to buy next item X.. (this happens 55 times and has a confidence of .55)

i've tried converting my list to an array using replace functions:

rules2 = str(rules)
rules2 = rules2.replace('(frozenset({', '[') 

but i dont think it's correct way to convert to a proper array?

I'm wanting to match the above list with a file of fresh transactions which looks like this: array([['D', 'F', 'G'], ['A', 'B'], dtype=object)

So that if a customer has bought products D F G i know what we should recommend next...

Many thanks who can help i'm really stuck! I tried to convert rules to dataframe but i get an error msg saying 'InterfaceError: Error binding parameter 1 - probably unsupported type.' when i try to query it

asked 21 secs ago

برچسب: convert python list to numpy array,convert python list to string,convert python list to json,convert python list to pandas dataframe,convert python list to set,convert python list to dictionary,convert python list to array,convert python list to float,convert python list to int,convert python list to tuple, نویسنده: استخدام کار تاريخ: پنجشنبه 18 شهريور 1395 ساعت: 17:59

صفحه بندی