def test_on_df_with_missing_entries(): # this is a data frame where information about # antecedents and consequents have been cropped # see https://github.com/rasbt/mlxtend/issues/390 # for more details dict = {'itemsets': [['177', '176'], ['177', '179'], ['176', '178'], ['176', '179'], ['93', '100'], ['177', '178'], ['177', '176', '178']], 'support': [0.253623, 0.253623, 0.217391, 0.217391, 0.181159, 0.108696, 0.108696]} df = pd.DataFrame(dict) numpy_assert_raises(KeyError, association_rules, df)
def test_on_df_with_missing_entries(): # this is a data frame where information about # antecedents and consequents have been cropped # see https://github.com/rasbt/mlxtend/issues/390 # for more details dict = { 'itemsets': [['177', '176'], ['177', '179'], ['176', '178'], ['176', '179'], ['93', '100'], ['177', '178'], ['177', '176', '178']], 'support': [0.253623, 0.253623, 0.217391, 0.217391, 0.181159, 0.108696, 0.108696] } df = pd.DataFrame(dict) numpy_assert_raises(KeyError, association_rules, df)
def test_wrong_metric(): numpy_assert_raises(ValueError, association_rules, df_freq_items, 'unicorn')
def test_no_itemsets_col(): df_no_itemsets_col = df_freq_items.loc[:, ['support']] numpy_assert_raises(ValueError, association_rules, df_no_itemsets_col)