简体   繁体   中英

How to fix 'POSTAGE' not found error in market basket analysis basket_sets.drop

I am using a large dataset to do market basket analysis, but I am not getting any results. How do I get past the error of:

'POSTAGE' not found in axis

I have commented out the code:

basket_sets.drop('POSTAGE', inplace=True, axis=1)

to see if it works without it, but I get no results.

def encode_units(x):
    if x <= 0:
        return 0
    if x >= 1:
        return 1

basket_sets = basket.applymap(encode_units)
basket_sets.drop('POSTAGE', inplace=True, axis=1)

I expect the output withantecedents, confidence etc

See here: Python MBA MBA

Remove this line from your code:

basket_sets.drop('POSTAGE', inplace=True, axis=1)

and script run to next line :

frequent_itemsets = apriori(basket, min_support=0.05, use_colnames=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM