# Notebook from 0lidaxiang/data-analysis
Path: homework3/.ipynb_checkpoints/main-checkpoint.ipynb

<code>
import pandas as pd
import csv
from mlxtend.frequent_patterns import apriori
from mlxtend.frequent_patterns import association_rules
_____no_output_____df = pd.read_excel('./data.xlsx')
df.head()_____no_output_____df['Description'] = df['Description'].str.strip()
df.dropna(axis=0, subset=['InvoiceNo'], inplace=True)
df['InvoiceNo'] = df['InvoiceNo'].astype('str')
df = df[~df['InvoiceNo'].str.contains('C')]_____no_output_____basket = (df[df['Country'] =="United Kingdom"]
          .groupby(['InvoiceNo', 'Description'])['Quantity']
          .sum().unstack().reset_index().fillna(0)
          .set_index('InvoiceNo'))_____no_output_____def encode_units(x):
    if x <= 0:
        return 0
    if x >= 1:
        return 1

basket_sets = basket.applymap(encode_units)
basket.drop('POSTAGE', inplace=True, axis=1)_____no_output_____df['Description'].shape_____no_output_____# basket[0:1].shape
# print(basket[0:1]["ACRYLIC JEWEL ANGEL,PINK"])
# print()
# for i in basket[0:1][:40]:
#     print(i)_____no_output_____frequent_itemsets = apriori(basket_sets, min_support=0.01, use_colnames=True)_____no_output_____# support  min threshold(0.01)，confidence  min threshold(0.5)
rules1 = association_rules(frequent_itemsets, metric="support", min_threshold= 0.01)
rules1.head()_____no_output_____rules2 = association_rules(frequent_itemsets, metric="confidence", min_threshold= 0.5)
rules2.head()_____no_output_____result1 = rules2[ (rules2['support'] >= 0.01) &
       (rules2['confidence'] >= 0.5) ]
print(result1.shape)
result1.head()(1055, 9)
result2 = result1

# test_res_1 = result2[:1]["antecedants"].values[0]
# slipt_str = test_res_1.split("{'")[1].split("'}")[0]

# teststr = "60 CAKE CASES DOLLY GIRL DESIGN"

# print( slipt_str, teststr, "\n",  slipt_str == teststr, "\n")
# print(result1["consequents"][:1])_____no_output_____# create the result csv
import numpy as np
submit_data = pd.read_csv('submit.csv')
print(submit_data.shape)
submit_data.head()

print(submit_data["Association Rule antecedants"][:3][0])
print(submit_data["Association Rule antecedants"][:3])

index = 1
final_result = np.zeros(3055)
print(type(result2), result2[:3], result2.shape)

for ant_res2,con_res2 in zip(result2["antecedants"], result2["consequents"]):
#     for sub in submit_data:
        print("\n\n res2", type(ant_res2), ant_res2)
        print("\n\n res2", type(con_res2), con_res2 )
#         test_res_1 = res2["antecedants"].values[0]
#         slipt_str1 = test_res_1.split("{'")[1].split("'}")[0]

#         test_res_2 = res2["consequents"].values[0]
#         slipt_str2 = test_res_1.split("{'")[1].split("'}")[0]

#         for sub1 in sub["Association Rule antecedants"]:
#             if sub1 == slipt_str1:
#                 for sub2 in sub["Association Rule consequents"]:
#                     if sub2 == slipt_str2:
#                         final_result[index] = 1
#                         print("1")
        index += 1
        (3055, 4)
WOODLAND CHARLOTTE BAG, CHARLOTTE BAG PINK POLKADOT
0    WOODLAND CHARLOTTE BAG, CHARLOTTE BAG PINK POL...
1                            FRENCH ENAMEL WATER BASIN
2       NATURAL SLATE HEART CHALKBOARD, DOTCOM POSTAGE
Name: Association Rule antecedants, dtype: object
<class 'pandas.core.frame.DataFrame'>                                       antecedants  \
0  frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})
1  frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})
2  frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

                            consequents  antecedent support  \
0  (PACK OF 60 PINK PAISLEY CAKE CASES)            0.019875
1     (PACK OF 72 RETROSPOT CAKE CASES)            0.019875
2     (PACK OF 72 RETROSPOT CAKE CASES)            0.040339

   consequent support   support  confidence       lift  leverage  conviction
0            0.041839  0.010125    0.509434  12.176189  0.009293    1.953175
1            0.060481  0.010928    0.549865   9.091527  0.009726    2.087195
2            0.060481  0.021910    0.543161   8.980674  0.019471    2.056563   (1055, 9)

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 60 PINK PAISLEY CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ASSORTED COLOUR BIRD ORNAMENT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BAKING SET 9 PIECE RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BATHROOM METAL SIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BATHROOM METAL SIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE HAPPY BIRTHDAY BUNTING'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PINK HAPPY BIRTHDAY BUNTING'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED  HARMONICA IN BOX'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WHITE SPOT BLUE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'BLUE STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"PAPER CHAIN KIT 50'S CHRISTMAS"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WHITE HANGING HEART T-LIGHT HOLDER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG APPLES DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG APPLE DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHOCOLATE HOT WATER BOTTLE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHOCOLATE HOT WATER BOTTLE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHRISTMAS CRAFT TREE TOP ANGEL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHRISTMAS CRAFT LITTLE FRIENDS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHRISTMAS CRAFT LITTLE FRIENDS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHRISTMAS CRAFT TREE TOP ANGEL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOLLY GIRL LUNCH BOX'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SPACEBOY LUNCH BOX'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG WOODLAND ANIMALS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO SHOPPER VINTAGE RED PAISLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FELTCRAFT CUSHION BUTTERFLY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FELTCRAFT CUSHION RABBIT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FELTCRAFT CUSHION OWL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FELTCRAFT PRINCESS LOLA DOLL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FELTCRAFT PRINCESS CHARLOTTE DOLL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'MODERN FLORAL STATIONERY SET'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FLORAL FOLK STATIONERY SET'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'VINTAGE PAISLEY STATIONERY SET'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'FLORAL FOLK STATIONERY SET'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GARDENERS KNEELING PAD CUP OF TEA'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GARDENERS KNEELING PAD KEEP CALM'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GREEN REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PINK REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GREEN REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GREEN REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'GREEN REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ROSES REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER OWL DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER SCOTTY DOG DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER BIRD DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER OWL DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER OWL DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER SCOTTY DOG DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER OWL DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER SCOTTY DOG DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HAND WARMER SCOTTY DOG DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HANGING HEART ZINC T-LIGHT HOLDER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HEART OF WICKER SMALL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER BASIL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER MINT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER BASIL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER PARSLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER ROSEMARY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER BASIL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER BASIL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER THYME'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER CHIVES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER PARSLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER MINT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER PARSLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER ROSEMARY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER MINT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER MINT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER THYME'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER ROSEMARY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER PARSLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER PARSLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER THYME'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER ROSEMARY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HERB MARKER THYME'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'HOT WATER BOTTLE KEEP CALM'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'IVORY KITCHEN SCALES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JAM JAR WITH GREEN LID'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JAM JAR WITH PINK LID'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"JUMBO BAG 50'S CHRISTMAS"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG APPLES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG VINTAGE LEAF'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG PINK VINTAGE PAISLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO SHOPPER VINTAGE RED PAISLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG WOODLAND ANIMALS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO SHOPPER VINTAGE RED PAISLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO SHOPPER VINTAGE RED PAISLEY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO STORAGE BAG SUKI'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'KEY FOB , BACK DOOR'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'KEY FOB , SHED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL HEART MEASURING SPOONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL WHITE HEART OF WICKER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG  BLACK SKULL.'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG APPLE DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG SPACEBOY DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'VINTAGE PAISLEY STATIONERY SET'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"PAPER CHAIN KIT 50'S CHRISTMAS"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PINK CREAM FELT CRAFT TRINKET BOX'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ROSES REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PINK REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SCANDINAVIAN PAISLEY PICNIC BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PINK VINTAGE PAISLEY PICNIC BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE BEDROOM"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE KITCHEN"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE LIVINGROOM"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE BEDROOM"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE LIVINGROOM"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({"POPPY'S PLAYHOUSE KITCHEN"})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RECYCLING BAG RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WHITE HANGING HEART T-LIGHT HOLDER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED SPOT CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WHITE SPOT RED CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED STRIPE CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WHITE SPOT RED CERAMIC DRAWER KNOB'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY MILK JUG PINK'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY SUGAR BOWL GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY MILK JUG PINK'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEAPOT ROSES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY SUGAR BOWL GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEAPOT ROSES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE PINK'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE ROSES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ROSES REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE ROSES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'REGENCY TEA PLATE PINK'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ROSES REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ROSES REGENCY TEACUP AND SAUCER'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 FAIRY CAKE BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 MINI LOAF BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 FAIRY CAKE BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 FAIRY CAKE BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 6 SNACK LOAF BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 MINI LOAF BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 6 TEA TIME BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 12 MINI LOAF BAKING CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 CAKE TINS PANTRY DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN HEART DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN HEART DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN SLEIGH DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN STOCKING DECORATION'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN SLEIGH DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN TREE DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN TREE DECORATIONS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 3 WOODEN STOCKING DECORATION'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 60 PANTRY DESIGN CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET OF 60 PANTRY DESIGN CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET/20 RED RETROSPOT PAPER NAPKINS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET/20 RED RETROSPOT PAPER NAPKINS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET/6 RED SPOTTY PAPER PLATES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SET/6 RED SPOTTY PAPER CUPS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY LUNCH BOX WITH CUTLERY'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SUKI  SHOULDER BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL DOLLY MIX DESIGN ORANGE BOWL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL MARSHMALLOWS PINK BOWL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL DOLLY MIX DESIGN ORANGE BOWL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'SMALL MARSHMALLOWS PINK BOWL'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CERAMIC TRINKET BOX'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'TRAVEL CARD WALLET KEEP CALM'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'VINTAGE SNAP CARDS'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN PICTURE FRAME WHITE FINISH'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN STAR CHRISTMAS SCANDINAVIAN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN HEART CHRISTMAS SCANDINAVIAN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN HEART CHRISTMAS SCANDINAVIAN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN STAR CHRISTMAS SCANDINAVIAN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODEN TREE CHRISTMAS SCANDINAVIAN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'60 TEATIME FAIRY CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN', 'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE RED'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'ALARM CLOCK BAKELIKE GREEN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'JUMBO BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'DOTCOM POSTAGE'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'PACK OF 72 RETROSPOT CAKE CASES'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG PINK POLKADOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'WOODLAND CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG RED RETROSPOT'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'LUNCH BAG  BLACK SKULL.'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'RED RETROSPOT CHARLOTTE BAG'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'CHARLOTTE BAG SUKI DESIGN'})

 res2 <class 'str'> frozenset({'60 CAKE CASES DOLLY GIRL DESIGN'})

 res2 <class 'frozenset'> frozenset({'STRAWBERRY CHARLOTTE BAG'})
basket2 = (df[df['Country'] =="Germany"]
          .groupby(['InvoiceNo', 'Description'])['Quantity']
          .sum().unstack().reset_index().fillna(0)
          .set_index('InvoiceNo'))

basket_sets2 = basket2.applymap(encode_units)
basket_sets2.drop('POSTAGE', inplace=True, axis=1)
frequent_itemsets2 = apriori(basket_sets2, min_support=0.05, use_colnames=True)
rules2 = association_rules(frequent_itemsets2, metric="lift", min_threshold=1)

rules2[ (rules2['lift'] >= 4) &
        (rules2['confidence'] >= 0.5)]_____no_output_____
</code>


# Notebook from Sifatul22/Web-Database-Analytics
Path: Yelp_Review/Yelp_Reviews_Functional.ipynb

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
import requests
import os_____no_output_____def build_url():

    place = input("Please enter the name of the place (city, State) you want to search restaurants in (e.g. \"Fremont, CA\"): ")
    lst = [x.strip() for x in place.split(',')]
    if len(lst[0].split())>1:
        lst[0] ='+'.join(lst[0].split())

    baseurl = 'https://www.yelp.com/search?find_desc=Restaurants&find_loc='
    url = baseurl +lst[0]+',+'+lst[1]

    return url_____no_output_____def query_restaurant(num_restaurant=10):

    import urllib.request, urllib.parse, urllib.error
    from bs4 import BeautifulSoup
    import ssl
    import pandas as pd

    num_loop_restaurant = 1+int(num_restaurant/11)

    url = build_url()

    if num_loop_restaurant==1:
        soup=read_soup_HTML(url)
        restaurant_names = build_restaurant_names(soup)
        restaurant_links = build_restaurant_links(soup)
    else:
        soup=read_soup_HTML(url)
        restaurant_names = build_restaurant_names(soup)
        restaurant_links = build_restaurant_links(soup)
        for i in range(1,num_loop_restaurant):
            url = url+'&start='+str(i*10)
            soup=read_soup_HTML(url)
            restaurant_names.extend(build_restaurant_names(soup))
            restaurant_links.extend(build_restaurant_links(soup))

    df=pd.DataFrame(data={'Link':restaurant_links,'Name':restaurant_names})
    print(df.iloc[:num_restaurant])

    return df.iloc[:num_restaurant]_____no_output_____def read_soup_HTML(url):

    import urllib.request, urllib.parse, urllib.error
    from bs4 import BeautifulSoup
    import ssl

    # Ignore SSL certificate errors
    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE

    # Read the HTML from the URL and pass on to BeautifulSoup
    #print("Opening the page", url)
    uh= urllib.request.urlopen(url, context=ctx)
    html =uh.read()
    soup = BeautifulSoup(html, 'html.parser')
    return soup_____no_output_____def build_restaurant_names (soup):
    restaurant_names = []
    for span in soup.find_all('span'):
        if 'class' in span.attrs:
            if span.attrs['class']==['indexed-biz-name']:
                restaurant_names.append(span.contents[1].get_text())

    return restaurant_names_____no_output_____def build_restaurant_links (soup):
    restaurant_links=[]
    for a in soup.find_all('a'):
        if 'class' in a.attrs:
            #print(a.attrs)
            if a.attrs['class']==['js-analytics-click']:
                restaurant_links.append(a.attrs['href'])
    _=restaurant_links.pop(0)

    for i in range(len(restaurant_links)):
        link='https://yelp.com'+restaurant_links[i]
        restaurant_links[i]=link

    return restaurant_links_____no_output_____query_restaurant(num_restaurant=15)Please enter the name of the place (city, State) you want to search restaurants in (e.g. "Fremont, CA"): San Jose, CA
                                                 Link  \
0   https://yelp.com/biz/firehouse-no-1-gastropub-...
1   https://yelp.com/biz/the-table-san-jose?frvs=T...
2   https://yelp.com/biz/braise-san-jose?frvs=True...
3   https://yelp.com/biz/the-grandview-restaurant-...
4   https://yelp.com/biz/ludwigs-german-table-san-...
5   https://yelp.com/biz/black-sheep-brasserie-san...
6   https://yelp.com/biz/pot-belly-ramen-san-jose?...
7   https://yelp.com/biz/taurinus-brazilian-steak-...
8   https://yelp.com/biz/our-house-san-jose-2?frvs...
9   https://yelp.com/biz/orchard-city-kitchen-camp...
10  https://yelp.com/biz/back-a-yard-san-jose?frvs...
11  https://yelp.com/biz/gen-korean-bbq-house-san-...
12  https://yelp.com/biz/vietnoms-san-jose?frvs=Tr...
13  https://yelp.com/biz/smoking-pig-bbq-san-jose?...
14  https://yelp.com/biz/our-house-san-jose-2?frvs...

                              Name
0         Firehouse No.1 Gastropub
1                        The Table
2                           Braise
3         The Grandview Restaurant
4             Ludwigs German Table
5            Black Sheep Brasserie
6                  Pot Belly Ramen
7   Taurinus Brazilian Steak House
8                        Our House
9             Orchard City Kitchen
10                     Back A Yard
11            Gen Korean BBQ House
12                        Vietnoms
13                 Smoking Pig BBQ
14                       Our House
def gather_reviews(df,num_reviews):

    reviews={}
    num_links=df.shape[0]
    num_loop_reviews = 1+int(num_reviews/21)
    for i in range(num_links):
        print(f"Gathering top reviews on {df.iloc[i]['Name']} now...")
        if num_loop_reviews==1:
            review_text=[]
            url=df.iloc[i]['Link']
            soup=read_soup_HTML(url)
            for p in soup.find_all('p'):
                if 'itemprop' in p.attrs:
                    if p.attrs['itemprop']=='description':
                        text=p.get_text().strip()
                        review_text.append(text)
        else:
            review_text=[]
            url=df.iloc[i]['Link']
            soup=read_soup_HTML(url)
            for p in soup.find_all('p'):
                if 'itemprop' in p.attrs:
                    if p.attrs['itemprop']=='description':
                        text=p.get_text().strip()
                        review_text.append(text)
            for i in range(1,num_loop_reviews):
                url=df.iloc[i]['Link']+'?start='+str(20*i)
                soup=read_soup_HTML(url)
                for p in soup.find_all('p'):
                    if 'itemprop' in p.attrs:
                        if p.attrs['itemprop']=='description':
                            text=p.get_text().strip()
                            review_text.append(text)

        reviews[str(df.iloc[i]['Name'])]=review_text[:num_reviews]

    return reviews_____no_output_____def get_reviews(num_restaurant=10,num_reviews=20):
    df_restaurants = query_restaurant(num_restaurant=num_restaurant)
    reviews = gather_reviews(df_restaurants,num_reviews=num_reviews)

    return reviews_____no_output_____

### Test cases_____no_output_____

rev = get_reviews(5,5)Please enter the name of the place (city, State) you want to search restaurants in (e.g. "Fremont, CA"): San Jose, CA
                                                Link                      Name
0  https://yelp.com/biz/firehouse-no-1-gastropub-...  Firehouse No.1 Gastropub
1  https://yelp.com/biz/braise-san-jose?frvs=True...                    Braise
2  https://yelp.com/biz/the-table-san-jose?frvs=T...                 The Table
3  https://yelp.com/biz/cajun-bistro-7-san-jose-2...            Cajun Bistro 7
4  https://yelp.com/biz/the-grandview-restaurant-...  The Grandview Restaurant
Gathering top reviews on Firehouse No.1 Gastropub now...
Gathering top reviews on Braise now...
Gathering top reviews on The Table now...
Gathering top reviews on Cajun Bistro 7 now...
Gathering top reviews on The Grandview Restaurant now...
count=0
for r in rev['The Table']:
    print(r)
    print("="*100)
    count+=1
print("\n Review count:", count)Service (5/5): Our waitress made sure our bottomless mimosas were constantly full lol. It was pretty busy but the servers were on it! Every server was willing to cater to any of our needs.

Ambiance (5/5): Dog friendly, open windows, cute decor, and an outdoor area.

Food (5/5): B--M-B. We ordered the chilaquiles, pork fried steak, salmon Benedict, and the loco moco. I didn't try the first two dishes I mentioned but out of the Benedict and loco moco my favorite was definitely the latter. If you like island food I highly recommend.

Price (4/5): My advice is to eat slow. The price was definitely worth its quality but the quantity isn't very big. My group was pretty full but it's because of the mimosas and we ordered monkey bread and beignets.
====================================================================================================
Our experience at The Table was OK, but I had higher expectations for a popular brunch place with 2,000+ reviews.

I knew the wait was going to be a nightmare for a weekend brunch, and they don't take reservations.  However, luckily I picked up a tip from another review that you can get put on the waitlist through the Yelp app.  The caveat is that you need to be within 5 miles of the restaurant.  Welp, I drove down to SJ and as soon as I got within the radius, I added myself to the waitlist.  I was a little horrified that there were 30 something people ahead of me (the app tells you), but this was about an hour before the actual time we wanted to eat.  Fingers crossed that waitlist goes down quickly.  It's cool in that you can see where you are in the queue from the app.  Note that it does require you to check into the restaurant by a given time.  Upon check in, the host seemed to indicate the wait time from Yelp isn't 100% accurate.  This made me worry, but I think we eventually got our seats maybe 15 to 20 minutes after the posted time.

The restaurant layout is fine and has both indoor and outdoor seating.  We ordered bottomless mimosas, some small starters, and some standard breakfast items (omelettes, sausage, eggs, etc).

This is a bit weird, but we noticed the water glasses smelled.  It wasn't awful, but it bore the lingering scent of having been dried with an old dish rag that hadn't been washed for a while.  One of our plates also had some residue and my napkin had some small stains.

Bottomless mimosas - I was a bit disappointed on how watered down it was, especially for such a popular brunch spot.  It was mostly OJ (perhaps water), and a splash of champagne.  It came in the small OJ glasses - the refill pace was OK, though there were times it went dry longer than I would like.  I like my alcohol, but won't be ordering this again as $12 is pricey for OJ.

The food - it was OK.  Nothing to really write home about.  Entrees will set you back about $15-$17 on average.

Overall, The Table is OK, but I don't have any compelling reason to come back.  Waits are long, mimosas are weak, and food is mediocre.  Service was at least fine.
====================================================================================================
I had such high hopes for this place. Out of all the brunch spots in Willow Glen, this one always appears to be the liveliest and most crowded. I was looking forward to seeing what all the hype was about.

First of all, there's the long wait times. This is to be expected on a Sunday morning. I believe we waited about 90 minutes for a table for 2. I didn't mind because it was a beautiful day outside. We walked down to Starbucks to grab some coffee and killed time by checking out all the cute dogs in the area.

We eventually receive a text that our table is ready and to check in with the host. Cool. We waited a couple of minutes because there's two random girls standing in front of the host station. Once we realized they weren't in line, we walked up to the station and waited ANOTHER couple of minutes to get the host's attention. He was there doing nothing important. Not sure why it took him so long to acknowledge our existence. He tells us to check in with the host inside. Ok, maybe the text should've been clearer about who we needed to check in with. So we walk inside and the two random girls from outside follow us. The host inside acknowledges them first even though we got there before them and seated them first. I'm already starting to get mad because we waited over an hour for this table and now I feel like I'm being ignored. We waited ANOTHER couple of minutes for them to get the table ready, even though the text said our table was already ready for us. Hmm, maybe we wouldn't have to wait so long if they didn't seat those girls before us.

I order the vegetarian chilaquiles and bottomless mimosa, of course. The food was fine. I'm glad the server asked if I wanted my poached egg to be cooked a little bit more, but besides that, the food didn't blow me away. Maybe I'm spoiled by all the awesome brunch places in SF and Oakland, but it was just ok. I think my experience was mostly ruined by the bad service here. When I order a bottomless mimosa, I expect my glass to be refilled every single time it's empty. That's the definition of bottomless and that's how every brunch place I go to works. The server did a horrible job at doing this. By the time we were eating, it wasn't super busy anymore. We watched her do "busy work" like folding napkins and etc. I used to be a bartender, so I know what it's like. You try to keep yourself busy when it's slow, but our glasses were empty and there were empty plates on our table. The server's job is to ask us if we're done with the plates, so they may remove them, and to refill our bottomless mimosas, but she was too busy folding napkins.

We ordered the beignets as dessert, but I wish we hadn't because they were already rushing us to pay and leave. I just wanted to enjoy the beignets and have some more of my BOTTOMLESS mimosa, but I no longer felt welcomed here. The server already left the check and was checking back to see if we paid but didn't bother to refill our drinks. We weren't obviously done if we barely just got the beignets.

I would've came back despite the food just being ok if the service was better, but I honestly don't want to come back here again. There are so many other brunch places in the area, so why bother?
====================================================================================================
AMAZING FOOD, great venue, horrendous wait time, and average wait service. I will concede that the wait is justified since the place is really popular and the food is really good, so I will say that it is worth the wait. We ended up waiting about an hour to get seated, but once we were seated our food came out in a timely manner. As for the service, our waiter came off as though he really didn't want to be there and it made me reluctant to ask for more water or juice if he walked by. To be fair, it was pretty packed the day we went, so I'll give him the benefit of the doubt.

So the food. Their freshly squeezed orange juice is something I highly recommend getting! It's fresh and sweet and I could probably drink it all day long. The food is quite flavorful and you can tell what is made from scratch. My boyfriend got the traditional breakfast and I got the lemon ricotta pancakes with their seasonal preserve, and we were definitely not disappointed. I LOVED the seasonal preserve that came with my pancakes, I really wish I had asked for more. My boyfriend cleared his plate before I even got through half of mine! Might have been the hunger, but he did say that his food was really good.
====================================================================================================
Be sure to come early, they don't take reservations, and your wait time can be anywhere between 30 min to 1 hour. There's not much to do around either while you wait.

I'll be honest I came for the smoked salmon eggs benedict, but The Table has the most expensive smoked salmon eggs benedict I've seen anywhere. The item is $20 BEFORE tax and tip. I'm willing to pay a bit more for good food, but that's a little too much. This place should be 3 dollar signs.

I ordered the lemon ricotta pancakes with lemon curd and blueberry compote, my friend ordered the special of the day (avocado uni toast with scrambled eggs and arugula), and we both shared the other special of the day, pull-apart monkey bread with salted caramel dipping sauce.

Pancakes were yummy but there was no wow factor, it was honestly a very okay experience. They were just pancakes, nothing that kept me thinking about them afterwards.

Can't speak for the avocado uni toast as I can't bring myself to eat anything avocado related, but my friend said it was just the right amount of food and delicious.

The monkey bread was delicious - crispy on the outside, and soft and fluffy on the inside, and the salted caramel dipping sauce was a nice complement.

Also, they take reservations, but not for weekend brunch, only for dinners.
====================================================================================================

 Review count: 5


# Notebook from hritwizsri/data-science-portfolio
Path: ML Micro Projects/Recommender Systems with Python.ipynb

# Movie Recommendation System with Python

In this project, we'll develop a basic recommender system with Python and pandas.

Movies will be suggested by similarity to other movies; this is not a robust recommendation system, but something to start out on._____no_output_____

import numpy as np
import pandas as pd_____no_output_____

## Data_____no_output_____We have two datasets:

- A dataset of movie ratings.
- A dataset of all movies titles and their ids._____no_output_____

#Reading the ratings dataset.
column_names = ['user_id', 'item_id', 'rating', 'timestamp']
df = pd.read_csv('data/u.data', sep='\t', names=column_names)_____no_output_____df.head()_____no_output_____

Reading the movie titles_____no_output_____

movie_titles = pd.read_csv("data/Movie_Id_Titles")
movie_titles.head()_____no_output_____

We can merge them together:_____no_output_____

df = pd.merge(df,movie_titles,on='item_id')
df.head()_____no_output_____

## Exploratory Analysis

Let's explore the data a bit and get a look at some of the best rated movies.
_____no_output_____

import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
%matplotlib inline_____no_output_____

Let's create a ratings dataframe with average rating and number of ratings:_____no_output_____

df.groupby('title')['rating'].mean().sort_values(ascending=False).head()_____no_output_____df.groupby('title')['rating'].count().sort_values(ascending=False).head()_____no_output_____ratings = pd.DataFrame(df.groupby('title')['rating'].mean())
ratings.head()_____no_output_____

Setting the number of ratings column:_____no_output_____

ratings['num of ratings'] = pd.DataFrame(df.groupby('title')['rating'].count())
ratings.head()_____no_output_____

Visualizing the number of ratings:_____no_output_____

plt.figure(figsize=(10,4))
ratings['num of ratings'].hist(bins=40)_____no_output_____plt.figure(figsize=(10,4))
ratings['rating'].hist(bins=40)_____no_output_____

It makes intuitive sense for most ratings to be around the 3.0 mark._____no_output_____## Recommending Similar Movies_____no_output_____The next step is to create a martix that has the user ids on one axis and the movie titles on another. Each cell will then consist of the rating of a movie by a particular user_____no_output_____

moviemat = df.pivot_table(index='user_id',columns='title',values='rating')
moviemat.head()_____no_output_____

It's normal for there to be lots of NaN values, as not everyone would have seen most movies._____no_output_____Checking out the Most rated movie:_____no_output_____

ratings.sort_values('num of ratings',ascending=False).head(10)_____no_output_____

Let's choose two movies to focus on: starwars, a sci-fi movie. And Dumb and Dumber, a comedy._____no_output_____

ratings.head()_____no_output_____

Now let's grab the user ratings for those two movies:_____no_output_____

starwars_user_ratings = moviemat['Star Wars (1977)']
dumb_user_ratings = moviemat['Liar Liar (1997)']
starwars_user_ratings.head()_____no_output_____

We can then use corrwith() method to get correlations between two pandas series:_____no_output_____

similar_to_starwars = moviemat.corrwith(starwars_user_ratings)
similar_to_liarliar = moviemat.corrwith(dumb_user_ratings)/Users/sajal/anaconda/lib/python3.5/site-packages/numpy/lib/function_base.py:2487: RuntimeWarning: Degrees of freedom <= 0 for slice
  warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning)

Let's clean the data by removing NaN values and using a DataFrame instead of a series:_____no_output_____

corr_starwars = pd.DataFrame(similar_to_starwars,columns=['Correlation'])
corr_starwars.dropna(inplace=True)
corr_starwars.head()_____no_output_____

If we sort the dataframe by correlation, we should get the most similar movies, however there will be some results that don't really make sense.

This is because there are a lot of movies only watched once by users who also watched star wars (it was the most popular movie). _____no_output_____

corr_starwars.sort_values('Correlation',ascending=False).head(10)_____no_output_____

Let's fix this by filtering out movies that have less than 100 reviews (this value was chosen based off the histogram from earlier)._____no_output_____

corr_starwars = corr_starwars.join(ratings['num of ratings'])
corr_starwars.head()_____no_output_____

Now sort the values and notice how the titles make a lot more sense:_____no_output_____

corr_starwars[corr_starwars['num of ratings']>100].sort_values('Correlation',ascending=False).head()_____no_output_____

Now the same for Liar Liar:_____no_output_____

corr_liarliar = pd.DataFrame(similar_to_liarliar,columns=['Correlation'])
corr_liarliar.dropna(inplace=True)
corr_liarliar = corr_liarliar.join(ratings['num of ratings'])
corr_liarliar[corr_liarliar['num of ratings']>100].sort_values('Correlation',ascending=False).head()_____no_output_____

And we're done!

It looks like our results make sense. Even though the system is far from state of the art, it still recommended the other Star Warss movies (and another George Lucas film) for Star Wars; while it looks like there's some scope for more improvement in Liar Liar (although we do get another Jim Carrey movie as a recommendation too._____no_output_____