of finding root vegetables in the previous transactions ( typicallya lift value of indicates that the probability of occurrence of the antecedent and consequent together are independent of each other hencethe idea is to look for rules having lift much greater than in our caseall the previously mentioned rules are good quality rules this is significant piece of informationas this can prompt retailer to bundle specific products like these together or run marketing scheme that offers discount on buying root vegetables along with these other three products we encourage you to try similar analyses with your own datasets in the future and also with the online retail transactions dataset that we used for our market segmentation case study considering the dataset online retail from market segmentationthe workflow for that particular analysis will be very similar the only difference among these two datasets is the way in which they are represented you can leverage the following code snippets to analyze patterns from the united kingdom in that dataset cs_mba pd read_excel(io= 'online retail xlsx'cs_mba_uk cs_mba[cs_mba country ='united kingdom'remove returned items cs_mba_uk cs_mba_uk[~(cs_mba_uk invoiceno str contains(" "=true)cs_mba_uk cs_mba_uk[~cs_mba_uk quantity< create transactional database items list(cs_mba_uk description unique()grouped cs_mba_uk groupby('invoiceno'transaction_level_df_uk grouped aggregate(lambda xtuple( )reset_index([['invoiceno','description']transaction_dict {item: for item in itemsoutput_dict dict(temp dict(for rec in transaction_level_df_uk to_dict('records')invoice_num rec['invoiceno'items_list rec['description'transaction_dict {item: for item in itemstransaction_dict update({item: for item in items if item in items_list}temp update({invoice_num:transaction_dict}new [ for , in temp items()tranasction_df pd dataframe(newdel(tranasction_df[tranasction_df columns[ ]]once you build the transactional datasetyou can choose your own configuration based on which you want to extract and mine rules for instancethe following code mines for patterns on the top most sold products with min-support of (min transactions and minimum confidence of output_df_uk_nitem_counts_n prune_dataset(input_df=tranasction_dflength_trans= start_item= end_item= input_assoc_rules output_df_uk_n domain_transac domain([discretevariable make(name=item,values=[' '' ']for item in input_assoc_rules columns]data_tran_uk orange data table from_numpy(domain=domain_transacx=input_assoc_rules as_matrix(),ynonedata_tran_uk_enmapping onehot encode(data_tran_ukinclude_class=true