In [161]:
import boto3
import pandas as pd
import matplotlib.pyplot as plt
import pickle
from nltk.stem.snowball import SnowballStemmer
from collections import Counter
import numpy as np
import time
%matplotlib inline
In [2]:
snowball = SnowballStemmer('english')
In [9]:
df = pd.read_csv("s3://dogfaces/reviews/extract_breed_review.csv")
In [10]:
df.head()
Out[10]:
rating
review_id
review_time
toy_id
toy_name
user_name
breed_extract
0
5
185682550
Sep 4, 2017
108574
mammoth-cottonblend-5-knot-dog-rope
Gunnerfavorite
NaN
1
5
185591533
Sep 1, 2017
108574
mammoth-cottonblend-5-knot-dog-rope
Lindsay
weimaraner
2
4
185522967
Aug 29, 2017
108574
mammoth-cottonblend-5-knot-dog-rope
bcodpas3
border terriers,border collie
3
5
185487336
Aug 28, 2017
108574
mammoth-cottonblend-5-knot-dog-rope
SickPup
NaN
4
5
185484167
Aug 28, 2017
108574
mammoth-cottonblend-5-knot-dog-rope
AussieMom
australian cattle dogs,australian shepherd
input: a probability vector of dog breeds top 3:
toy -> breed score(averaged score for that breed)
return probability weighted review scores
In [11]:
# 52 base classes:
# source 2: classified dog names
breed_classes = pd.read_csv("s3://dogfaces/tensor_model/output_labels_20170907.txt",names=['breed'])
base_breeds = breed_classes['breed'].values
In [12]:
base_breeds
Out[12]:
array(['rottweiler', 'bull mastiff', 'french bulldog', 'cairn',
'yorkshire terrier', 'great dane', 'standard poodle', 'malinois',
'wheaten terrier', 'collie', 'papillon', 'weimaraner', 'samoyed',
'doberman', 'shetland sheepdog', 'whippet', 'american bulldog',
'beagle', 'chihuahua', 'chesapeake bay retriever',
'golden retriever', 'american pit bull terrier', 'english foxhound',
'vizsla', 'great pyrenees', 'basset', 'miniature schnauzer',
'siberian husky', 'pomeranian', 'english springer', 'pug',
'bernese mountain dog', 'miniature poodle',
'soft coated wheaten terrier', 'tibetan mastiff', 'havanese',
'miniature pinscher', 'border collie', 'toy poodle', 'bloodhound',
'german shorthaired', 'malamute', 'labrador retriever',
'german shepherd', 'chow', 'scottish terrier', 'boxer', 'shih tzu',
'basset hound', 'shiba inu', 'newfoundland', 'rhodesian ridgeback',
'west highland white terrier'], dtype=object)
In [13]:
with open('breed_lookup.pickle', 'rb') as handle:
rev_to_breed = pickle.load(handle)
len(rev_to_breed)
Out[13]:
604
In [14]:
with open('breed_dict.pickle', 'rb') as handle:
breed_to_rev = pickle.load(handle)
len(breed_to_rev)
Out[14]:
163
In [35]:
# sanity check
not_found = 0
for breed in base_breeds:
if breed not in breed_to_rev:
if snowball.stem(breed) in breed_to_rev:
print "only need to stem "+breed
elif snowball.stem(breed) in rev_to_breed:
print "need to look up extened dict "+ breed +" : "+str(rev_to_breed[snowball.stem(breed)])
else:
print "not found " + breed
not_found += 1
print not_found
0
In [62]:
mini_set = df.sample(10).copy()
base_breeds_set = set(base_breeds)
In [63]:
# review_id, toy_id, breeds.....
def get_breed_score(df):
score_df = []
for idx, row in df.iterrows():
score_row = {}
score_row['review_id'] = row['review_id']
score_row['toy_id'] = row['toy_id']
score_row['rating'] = row['rating']
try:
breed_extract = row['breed_extract'].split(',')
matched_item = {}
for b in breed_extract:
if b in base_breeds_set:
matched_item[b] = matched_item.get(b,0)+1
max_p = max(matched_item.values())
total_base = 0
for k, v in matched_item.iteritems():
if v== max_p:
total_base += 1
for k, v in matched_item.iteritems():
if v == max_p:
score_row[k] = 1.0/total_base
except:
pass
score_df.append(score_row)
return score_df
In [65]:
scored_lst = get_breed_score(df)
In [66]:
scored_df = pd.DataFrame(scored_lst)
In [71]:
scored_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 61202 entries, 0 to 61201
Data columns (total 56 columns):
american bulldog 729 non-null float64
american pit bull terrier 2523 non-null float64
basset 340 non-null float64
basset hound 304 non-null float64
beagle 336 non-null float64
bernese mountain dog 94 non-null float64
bloodhound 35 non-null float64
border collie 622 non-null float64
boxer 844 non-null float64
bull mastiff 46 non-null float64
cairn 945 non-null float64
chesapeake bay retriever 502 non-null float64
chihuahua 445 non-null float64
chow 39 non-null float64
collie 156 non-null float64
doberman 510 non-null float64
english foxhound 443 non-null float64
english springer 754 non-null float64
french bulldog 630 non-null float64
german shepherd 2760 non-null float64
german shorthaired 597 non-null float64
golden retriever 2035 non-null float64
great dane 630 non-null float64
great pyrenees 99 non-null float64
havanese 99 non-null float64
labrador retriever 4398 non-null float64
malamute 59 non-null float64
malinois 128 non-null float64
miniature pinscher 122 non-null float64
miniature poodle 387 non-null float64
miniature schnauzer 353 non-null float64
newfoundland 79 non-null float64
papillon 47 non-null float64
pomeranian 158 non-null float64
pug 205 non-null float64
rating 61202 non-null int64
review_id 61202 non-null int64
rhodesian ridgeback 77 non-null float64
rottweiler 574 non-null float64
samoyed 19 non-null float64
scottish terrier 942 non-null float64
shetland sheepdog 132 non-null float64
shiba inu 55 non-null float64
shih tzu 260 non-null float64
siberian husky 419 non-null float64
soft coated wheaten terrier 941 non-null float64
standard poodle 584 non-null float64
tibetan mastiff 361 non-null float64
toy poodle 242 non-null float64
toy_id 61202 non-null int64
vizsla 75 non-null float64
weimaraner 94 non-null float64
west highland white terrier 1016 non-null float64
wheaten terrier 941 non-null float64
whippet 28 non-null float64
yorkshire terrier 1429 non-null float64
dtypes: float64(53), int64(3)
memory usage: 26.1 MB
In [72]:
scored_df.fillna(0, inplace=True)
In [73]:
scored_df.head()
Out[73]:
american bulldog
american pit bull terrier
basset
basset hound
beagle
bernese mountain dog
bloodhound
border collie
boxer
bull mastiff
...
standard poodle
tibetan mastiff
toy poodle
toy_id
vizsla
weimaraner
west highland white terrier
wheaten terrier
whippet
yorkshire terrier
0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.0
0.0
0.0
108574
0.0
0.0
0.0
0.0
0.0
0.0
1
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.0
0.0
0.0
108574
0.0
1.0
0.0
0.0
0.0
0.0
2
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.0
0.0
0.0
...
0.0
0.0
0.0
108574
0.0
0.0
0.0
0.0
0.0
0.0
3
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.0
0.0
0.0
108574
0.0
0.0
0.0
0.0
0.0
0.0
4
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.0
0.0
0.0
108574
0.0
0.0
0.0
0.0
0.0
0.0
5 rows × 56 columns
In [3]:
save_data = scored_df.to_csv(index=False)
s3_res = boto3.resource('s3')
s3_res.Bucket('dogfaces').put_object(Key='reviews/scored_breed_review.csv', Body=save_data)
-----------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-845ec9bf9fb9> in <module>()
----> 1 save_data = scored_df.to_csv(index=False)
2 s3_res = boto3.resource('s3')
3 s3_res.Bucket('dogfaces').put_object(Key='reviews/scored_breed_review.csv', Body=save_data)
NameError: name 'scored_df' is not defined
In [4]:
# sanity check
scored_df = pd.read_csv("s3://dogfaces/reviews/scored_breed_review.csv")
In [5]:
scored_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 61202 entries, 0 to 61201
Data columns (total 56 columns):
american bulldog 61202 non-null float64
american pit bull terrier 61202 non-null float64
basset 61202 non-null float64
basset hound 61202 non-null float64
beagle 61202 non-null float64
bernese mountain dog 61202 non-null float64
bloodhound 61202 non-null float64
border collie 61202 non-null float64
boxer 61202 non-null float64
bull mastiff 61202 non-null float64
cairn 61202 non-null float64
chesapeake bay retriever 61202 non-null float64
chihuahua 61202 non-null float64
chow 61202 non-null float64
collie 61202 non-null float64
doberman 61202 non-null float64
english foxhound 61202 non-null float64
english springer 61202 non-null float64
french bulldog 61202 non-null float64
german shepherd 61202 non-null float64
german shorthaired 61202 non-null float64
golden retriever 61202 non-null float64
great dane 61202 non-null float64
great pyrenees 61202 non-null float64
havanese 61202 non-null float64
labrador retriever 61202 non-null float64
malamute 61202 non-null float64
malinois 61202 non-null float64
miniature pinscher 61202 non-null float64
miniature poodle 61202 non-null float64
miniature schnauzer 61202 non-null float64
newfoundland 61202 non-null float64
papillon 61202 non-null float64
pomeranian 61202 non-null float64
pug 61202 non-null float64
rating 61202 non-null int64
review_id 61202 non-null int64
rhodesian ridgeback 61202 non-null float64
rottweiler 61202 non-null float64
samoyed 61202 non-null float64
scottish terrier 61202 non-null float64
shetland sheepdog 61202 non-null float64
shiba inu 61202 non-null float64
shih tzu 61202 non-null float64
siberian husky 61202 non-null float64
soft coated wheaten terrier 61202 non-null float64
standard poodle 61202 non-null float64
tibetan mastiff 61202 non-null float64
toy poodle 61202 non-null float64
toy_id 61202 non-null int64
vizsla 61202 non-null float64
weimaraner 61202 non-null float64
west highland white terrier 61202 non-null float64
wheaten terrier 61202 non-null float64
whippet 61202 non-null float64
yorkshire terrier 61202 non-null float64
dtypes: float64(53), int64(3)
memory usage: 26.1 MB
In [6]:
# calculating each toy's score
#df_scored = scored_df.copy()
df_scored = scored_df.copy()
df_scored.pop('review_id')
df_scored.pop('rating')
def non_zero_count(x):
return np.sum(x[x>0])
df_breed_count = df_scored.groupby('toy_id').agg(non_zero_count).reset_index()
df_breed_count.head()
Out[6]:
toy_id
american bulldog
american pit bull terrier
basset
basset hound
beagle
bernese mountain dog
bloodhound
border collie
boxer
...
soft coated wheaten terrier
standard poodle
tibetan mastiff
toy poodle
vizsla
weimaraner
west highland white terrier
wheaten terrier
whippet
yorkshire terrier
0
38347
0.0
0.428571
0.5
0.5
0.0
0.0
0.0
2.0
2.0
...
0.428571
2.000000
0.000000
0.000000
0.0
0.0
0.428571
0.428571
0.0
0.428571
1
38359
0.0
1.142857
0.0
0.0
0.5
0.0
0.0
3.0
2.0
...
0.142857
3.000000
0.000000
0.000000
0.0
0.0
0.142857
0.142857
0.0
1.142857
2
38362
0.0
0.000000
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.000000
1.000000
0.000000
0.000000
0.0
0.0
0.000000
0.000000
0.0
0.000000
3
38365
0.0
1.000000
0.0
0.0
0.0
1.0
0.0
2.5
0.0
...
0.000000
3.000000
0.000000
0.000000
0.0
0.0
0.000000
0.000000
0.0
0.000000
4
38371
2.0
17.087302
0.5
0.5
1.0
1.0
0.0
6.5
5.5
...
1.253968
4.333333
0.611111
0.333333
0.0
0.0
3.253968
1.253968
0.0
1.753968
5 rows × 54 columns
In [7]:
breed_columns = [x for x in scored_df.columns if x not in ['toy_id', 'rating', 'review_id']]
mat_scored2 = scored_df[breed_columns].copy().values
In [9]:
mat_scored2 = scored_df['rating'].values.reshape((61202,1))*mat_scored2
In [11]:
df_scored_sum = pd.DataFrame(data=mat_scored2, columns=breed_columns)
df_scored_sum = pd.concat([scored_df['toy_id'].copy(), df_scored_sum], axis=1)
In [15]:
df_breed_wet_sum = df_scored_sum.groupby('toy_id').sum().reset_index()
df_breed_wet_sum.head()
Out[15]:
toy_id
american bulldog
american pit bull terrier
basset
basset hound
beagle
bernese mountain dog
bloodhound
border collie
boxer
...
soft coated wheaten terrier
standard poodle
tibetan mastiff
toy poodle
vizsla
weimaraner
west highland white terrier
wheaten terrier
whippet
yorkshire terrier
0
38347
0.0
2.142857
2.5
2.5
0.0
0.0
0.0
10.0
10.0
...
2.142857
9.000000
0.000000
0.000000
0.0
0.0
2.142857
2.142857
0.0
2.142857
1
38359
0.0
5.714286
0.0
0.0
2.5
0.0
0.0
10.0
10.0
...
0.714286
15.000000
0.000000
0.000000
0.0
0.0
0.714286
0.714286
0.0
5.714286
2
38362
0.0
0.000000
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...
0.000000
5.000000
0.000000
0.000000
0.0
0.0
0.000000
0.000000
0.0
0.000000
3
38365
0.0
5.000000
0.0
0.0
0.0
5.0
0.0
12.0
0.0
...
0.000000
10.000000
0.000000
0.000000
0.0
0.0
0.000000
0.000000
0.0
0.000000
4
38371
10.0
84.936508
2.5
2.5
5.0
5.0
0.0
32.5
27.5
...
6.269841
21.666667
3.055556
1.666667
0.0
0.0
16.269841
6.269841
0.0
8.769841
5 rows × 54 columns
In [20]:
df_breed_wet_sum.sort_values(by='toy_id', axis=0, inplace=True)
df_breed_count.sort_values(by='toy_id', axis=0, inplace=True)
In [22]:
weighted_mat = df_breed_count[breed_columns].values
weighted_sum = df_breed_wet_sum[breed_columns].values
with np.errstate(divide='ignore', invalid='ignore'):
res_mat = np.true_divide(weighted_sum, weighted_mat)
res_mat[res_mat==np.inf]=0
res_mat = np.nan_to_num(res_mat)
In [25]:
df_scored_finalscore = pd.DataFrame(data=res_mat, columns=breed_columns)
df_scored_finalscore = pd.concat([df_breed_count['toy_id'].copy(), df_scored_finalscore], axis=1)
In [26]:
df_scored_finalscore.head()
Out[26]:
toy_id
american bulldog
american pit bull terrier
basset
basset hound
beagle
bernese mountain dog
bloodhound
border collie
boxer
...
soft coated wheaten terrier
standard poodle
tibetan mastiff
toy poodle
vizsla
weimaraner
west highland white terrier
wheaten terrier
whippet
yorkshire terrier
0
38347
0.0
5.000000
5.0
5.0
0.0
0.0
0.0
5.000000
5.0
...
5.0
4.500000
0.0
0.0
0.0
0.0
5.0
5.0
0.0
5.0
1
38359
0.0
5.000000
0.0
0.0
5.0
0.0
0.0
3.333333
5.0
...
5.0
5.000000
0.0
0.0
0.0
0.0
5.0
5.0
0.0
5.0
2
38362
0.0
0.000000
0.0
0.0
0.0
0.0
0.0
0.000000
0.0
...
0.0
5.000000
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
3
38365
0.0
5.000000
0.0
0.0
0.0
5.0
0.0
4.800000
0.0
...
0.0
3.333333
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
4
38371
5.0
4.970739
5.0
5.0
5.0
5.0
0.0
5.000000
5.0
...
5.0
5.000000
5.0
5.0
0.0
0.0
5.0
5.0
0.0
5.0
5 rows × 54 columns
In [31]:
df_toy = pd.read_csv("s3://dogfaces/reviews/toys.csv")
df_toy.head(3)
Out[31]:
cat_id
num_reviews
picture_link
price
toy_id
toy_link
toy_name
0
1
800
https://img.chewy.com/is/catalog/62758_MAIN._A...
$1.19
47728
https://www.chewy.com/kong-airdog-squeakair-ba...
kong-airdog-squeakair-ball-dog-toy
1
1
127
https://img.chewy.com/is/catalog/80753._AC_SS1...
$2.99
108582
https://www.chewy.com/mammoth-monkey-fist-bar-...
mammoth-monkey-fist-bar-dog-toy
2
1
292
https://img.chewy.com/is/catalog/62850._AC_SS1...
$3.39
47880
https://www.chewy.com/kong-squeakair-birthday-...
kong-squeakair-birthday-balls-dog
In [ ]:
# make recommendations:
def getRecommendations(probs, score_df, toy_df, k, add_info=None):
# probs is a dictionary
keys = probs.keys()
D = score_df.shape[1]-1
prob_v = np.array(probs.values()).reshape((D,1))
score_mat = score_df[keys].values
fscore_mat = score_mat.dot(prob_v)
top_ind = np.argsort(-fscore_mat[:,0])[:k]
top_toy = score_df['toy_id'].values[top_ind]
likely_ratings = pd.DataFrame({"likely rating":fscore_mat[:,0][top_ind]}, index=None)
if not add_info:
toy_info = toy_df[toy_df['toy_id'].isin(top_toy)][['toy_id','toy_name','price']].copy()
else:
add_info.extend(['toy_id','toy_name','price'])
toy_info = toy_df[toy_df['toy_id'].isin(top_toy)][add_info].copy()
return pd.concat([toy_info.reset_index(), likely_ratings], axis=1)
def getRecommendedToys():
pass
def getToyDislie():
pass
In [163]:
# get recommendations
for i in xrange(53):
probs = [0]*53
ind = i#np.random.randint(53)
probs[ind]=1
print breed_columns[ind]
test_input = dict(zip(breed_columns, probs))
print getRecommendations(test_input,df_scored_finalscore, df_toy, 3, ['toy_link'] )
time.sleep(2)
american bulldog
index toy_link toy_id \
0 17 https://www.chewy.com/gnawsome-squeaker-footba... 156822
1 193 https://www.chewy.com/chuckit-fumble-fetch-sma... 49740
2 266 https://www.chewy.com/chuckit-fetch-ball-dog-t... 49747
toy_name price likely rating
0 gnawsome-squeaker-football-dog-toy $2.99 5.0
1 chuckit-fumble-fetch-small $17.36 5.0
2 chuckit-fetch-ball-dog-toy-color $7.95 5.0
american pit bull terrier
index toy_link toy_id \
0 209 https://www.chewy.com/jolly-pets-jolly-jumper-... 102390
1 264 https://www.chewy.com/jw-pet-treat-puzzler-bal... 55977
2 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
toy_name price likely rating
0 jolly-pets-jolly-jumper-ball-dog-toy $6.59 5.0
1 jw-pet-treat-puzzler-ball-dog-toy $8.99 5.0
2 multipet-boingo-ball-dog-toy-color $9.43 5.0
basset
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 537 https://www.chewy.com/kong-cozie-baily-blue-do... 47734
2 584 https://www.chewy.com/kong-cozie-rosie-rhino-d... 47740
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 kong-cozie-baily-blue-dog-toy $5.49 5.0
2 kong-cozie-rosie-rhino-dog-toy $4.99 5.0
basset hound
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 122 https://www.chewy.com/ourpets-buster-food-cube... 45924
2 173 https://www.chewy.com/planet-dog-orbee-tuff-sp... 47263
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 ourpets-buster-food-cube-dog-toy $12.09 5.0
2 planet-dog-orbee-tuff-sport-soccer $22.95 5.0
beagle
index toy_link toy_id \
0 58 https://www.chewy.com/omega-paw-tricky-treat-b... 51234
1 540 https://www.chewy.com/kong-plush-duck-dog-toy-... 51534
2 743 https://www.chewy.com/west-paw-design-big-sky-... 116831
toy_name price likely rating
0 omega-paw-tricky-treat-ball-dog-toy $8.42 5.0
1 kong-plush-duck-dog-toy-small $3.19 5.0
2 west-paw-design-big-sky-puppy-dog $9.95 5.0
bernese mountain dog
index toy_link toy_id \
0 109 https://www.chewy.com/kong-stuff-ball-dog-toy-... 44162
1 167 https://www.chewy.com/jw-pet-isqueak-bone-dog-... 55957
2 421 https://www.chewy.com/ethical-pet-play-strong-... 117994
toy_name price likely rating
0 kong-stuff-ball-dog-toy-large $9.99 5.0
1 jw-pet-isqueak-bone-dog-toy-color $6.17 5.0
2 ethical-pet-play-strong-rubber-s $7.49 5.0
bloodhound
index toy_link toy_id \
0 57 https://www.chewy.com/kong-squeezz-dumbbell-do... 38503
1 181 https://www.chewy.com/kong-squeezz-football-do... 38507
2 535 https://www.chewy.com/outward-hound-hide-squir... 113786
toy_name price likely rating
0 kong-squeezz-dumbbell-dog-toy-color $6.78 5.0
1 kong-squeezz-football-dog-toy-color $4.99 5.0
2 outward-hound-hide-squirrel-puzzle $19.99 5.0
border collie
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 134 https://www.chewy.com/starmark-easy-glide-dura... 45482
2 141 https://www.chewy.com/starmark-swing-n-fling-c... 45484
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 starmark-easy-glide-durafoam-disc $7.69 5.0
2 starmark-swing-n-fling-chew-ball-dog $10.99 5.0
boxer
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 37 https://www.chewy.com/chuckit-paraflight-flyer... 49710
2 342 https://www.chewy.com/kong-classic-dog-toy-med... 38484
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 chuckit-paraflight-flyer-large $7.66 5.0
2 kong-classic-dog-toy-medium $6.79 5.0
bull mastiff
index toy_link toy_id \
0 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
1 350 https://www.chewy.com/kong-puppy-dog-toy-color... 38488
2 543 https://www.chewy.com/kong-tuggerknots-moose-d... 43095
toy_name price likely rating
0 west-paw-design-zogoflex-jive-dog $14.95 5.0
1 kong-puppy-dog-toy-color-varies $4.79 5.0
2 kong-tuggerknots-moose-dog-toy $7.06 5.0
cairn
index toy_link toy_id \
0 4 https://www.chewy.com/chuckit-ultra-rubber-bal... 38371
1 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
2 357 https://www.chewy.com/nylabone-durachew-peanut... 108523
toy_name price likely rating
0 chuckit-ultra-rubber-ball-medium-2 $6.85 5.0
1 multipet-boingo-ball-dog-toy-color $9.43 5.0
2 nylabone-durachew-peanut-butter $7.26 5.0
chesapeake bay retriever
index toy_link toy_id \
0 129 https://www.chewy.com/jw-pet-hol-ee-roller-x-e... 55900
1 338 https://www.chewy.com/nylabone-durachew-dental... 43349
2 811 https://www.chewy.com/mammoth-cottonblend-5-kn... 108574
toy_name price likely rating
0 jw-pet-hol-ee-roller-x-extreme-dog $8.95 5.0
1 nylabone-durachew-dental-chew-dino $4.87 5.0
2 mammoth-cottonblend-5-knot-dog-rope $8.47 5.0
chihuahua
index toy_link toy_id \
0 64 https://www.chewy.com/starmark-everlasting-ben... 106037
1 637 https://www.chewy.com/outward-hound-plush-sque... 113702
2 778 https://www.chewy.com/busy-buddy-natural-rawhi... 48181
toy_name price likely rating
0 starmark-everlasting-bento-ball $12.92 5.0
1 outward-hound-plush-squeaker-matz $9.99 5.0
2 busy-buddy-natural-rawhide-peanut $7.49 5.0
chow
index toy_link toy_id \
0 80 https://www.chewy.com/kong-squeezz-ring-dog-to... 38531
1 346 https://www.chewy.com/kong-extreme-dog-toy-x-l... 38494
2 387 https://www.chewy.com/kong-puppy-binkie-color-... 111145
toy_name price likely rating
0 kong-squeezz-ring-dog-toy-color $6.59 5.0
1 kong-extreme-dog-toy-x-large $9.29 5.0
2 kong-puppy-binkie-color-varies $5.19 5.0
collie
index toy_link toy_id \
0 82 https://www.chewy.com/ruff-dawg-k9-flyer-disc-... 38921
1 185 https://www.chewy.com/tuffys-mighty-dog-ball-o... 117807
2 412 https://www.chewy.com/busy-buddy-twist-n-treat... 48822
toy_name price likely rating
0 ruff-dawg-k9-flyer-disc-dog-toy $8.99 5.0
1 tuffys-mighty-dog-ball-orange-large $15.09 5.0
2 busy-buddy-twist-n-treat-dog-toy $7.95 5.0
doberman
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 632 https://www.chewy.com/ethical-pet-fleece-bone-... 56274
2 795 https://www.chewy.com/ethical-pet-seek-treat-f... 56277
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 ethical-pet-fleece-bone-dog-toy-bone $3.95 5.0
2 ethical-pet-seek-treat-flip-n-flap $10.63 5.0
english foxhound
index toy_link toy_id \
0 17 https://www.chewy.com/gnawsome-squeaker-footba... 156822
1 22 https://www.chewy.com/ethical-pet-plush-soccer... 56268
2 419 https://www.chewy.com/benebone-rotisserie-chic... 129004
toy_name price likely rating
0 gnawsome-squeaker-football-dog-toy $2.99 5.0
1 ethical-pet-plush-soccer-ball-dog $2.99 5.0
2 benebone-rotisserie-chicken-flavored $17.41 5.0
english springer
index toy_link toy_id \
0 17 https://www.chewy.com/gnawsome-squeaker-footba... 156822
1 534 https://www.chewy.com/kong-dynos-t-rex-dog-toy... 118890
2 601 https://www.chewy.com/kong-dynos-pterodactyl-d... 118893
toy_name price likely rating
0 gnawsome-squeaker-football-dog-toy $2.99 5.0
1 kong-dynos-t-rex-dog-toy-large $5.16 5.0
2 kong-dynos-pterodactyl-dog-toy-large $8.89 5.0
french bulldog
index toy_link toy_id \
0 17 https://www.chewy.com/gnawsome-squeaker-footba... 156822
1 434 https://www.chewy.com/nylabone-durachew-action... 39372
2 584 https://www.chewy.com/kong-cozie-rosie-rhino-d... 47740
toy_name price likely rating
0 gnawsome-squeaker-football-dog-toy $2.99 5.0
1 nylabone-durachew-action-ridges $11.53 5.0
2 kong-cozie-rosie-rhino-dog-toy $4.99 5.0
german shepherd
index toy_link toy_id \
0 16 https://www.chewy.com/chuckit-classic-launcher... 38347
1 241 https://www.chewy.com/kong-biscuit-ball-dog-to... 44152
2 348 https://www.chewy.com/kong-extreme-goodie-bone... 118907
toy_name price likely rating
0 chuckit-classic-launcher-color $6.99 5.0
1 kong-biscuit-ball-dog-toy-large $9.99 5.0
2 kong-extreme-goodie-bone-dog-toy $8.53 5.0
german shorthaired
index toy_link toy_id \
0 260 https://www.chewy.com/jw-pet-play-place-squeak... 108894
1 486 https://www.chewy.com/kong-dental-stick-dog-to... 44172
2 621 https://www.chewy.com/godog-just-me-chew-guard... 130071
toy_name price likely rating
0 jw-pet-play-place-squeaky-dog-ball $4.79 5.0
1 kong-dental-stick-dog-toy-large $7.11 5.0
2 godog-just-me-chew-guard-t-rex-dog $4.43 5.0
golden retriever
index toy_link toy_id \
0 58 https://www.chewy.com/omega-paw-tricky-treat-b... 51234
1 75 https://www.chewy.com/chuckit-zipflight-disc-d... 38376
2 80 https://www.chewy.com/kong-squeezz-ring-dog-to... 38531
toy_name price likely rating
0 omega-paw-tricky-treat-ball-dog-toy $8.42 5.0
1 chuckit-zipflight-disc-dog-toy-color $10.95 5.0
2 kong-squeezz-ring-dog-toy-color $6.59 5.0
great dane
index toy_link toy_id \
0 109 https://www.chewy.com/kong-stuff-ball-dog-toy-... 44162
1 152 https://www.chewy.com/tuffys-ocean-creatures-l... 39256
2 199 https://www.chewy.com/tuffys-ocean-creatures-g... 39280
toy_name price likely rating
0 kong-stuff-ball-dog-toy-large $9.99 5.0
1 tuffys-ocean-creatures-lil-oscar-dog $15.88 5.0
2 tuffys-ocean-creatures-general $13.36 5.0
great pyrenees
index toy_link toy_id \
0 343 https://www.chewy.com/nylabone-durachew-bacon-... 39407
1 393 https://www.chewy.com/nylabone-puppy-chew-teet... 39344
2 455 https://www.chewy.com/west-paw-design-zogoflex... 43039
toy_name price likely rating
0 nylabone-durachew-bacon-flavor-bone $8.61 5.0
1 nylabone-puppy-chew-teething-keys $7.60 5.0
2 west-paw-design-zogoflex-tux-dog-toy $18.95 5.0
havanese
index toy_link toy_id \
0 381 https://www.chewy.com/nylabone-durachew-chicke... 39377
1 403 https://www.chewy.com/jw-pet-crackle-heads-dou... 38470
2 513 https://www.chewy.com/kong-quest-critters-frog... 112248
toy_name price likely rating
0 nylabone-durachew-chicken-flavor $7.80 5.0
1 jw-pet-crackle-heads-dougie-dog-dog $4.99 5.0
2 kong-quest-critters-frog-dog-toy $6.99 5.0
labrador retriever
index toy_link toy_id \
0 354 https://www.chewy.com/nylabone-puppy-chew-teet... 39346
1 375 https://www.chewy.com/benebone-bacon-flavored-... 119505
2 529 https://www.chewy.com/nylabone-durachew-marrow... 102487
toy_name price likely rating
0 nylabone-puppy-chew-teething-rings $4.29 5.0
1 benebone-bacon-flavored-regular $12.56 5.0
2 nylabone-durachew-marrow-dog-bone $10.28 5.0
malamute
index toy_link toy_id \
0 64 https://www.chewy.com/starmark-everlasting-ben... 106037
1 371 https://www.chewy.com/benebone-rotisserie-chic... 112483
2 535 https://www.chewy.com/outward-hound-hide-squir... 113786
toy_name price likely rating
0 starmark-everlasting-bento-ball $12.92 5.0
1 benebone-rotisserie-chicken-flavored $11.59 5.0
2 outward-hound-hide-squirrel-puzzle $19.99 5.0
malinois
index toy_link toy_id \
0 42 https://www.chewy.com/chuckit-kick-fetch-ball-... 49718
1 441 https://www.chewy.com/nylabone-galileo-chew-bo... 44232
2 574 https://www.chewy.com/multipet-loofa-light-wei... 106583
toy_name price likely rating
0 chuckit-kick-fetch-ball-large $16.06 5.0
1 nylabone-galileo-chew-bone-dog-toy-x $13.99 5.0
2 multipet-loofa-light-weight-dog-toy $2.11 5.0
miniature pinscher
index toy_link toy_id \
0 379 https://www.chewy.com/kong-goodie-bone-dog-toy... 44207
1 466 https://www.chewy.com/petstages-orka-bone-dog-... 46927
2 599 https://www.chewy.com/ethical-pet-skinneeez-fo... 56248
toy_name price likely rating
0 kong-goodie-bone-dog-toy-large $7.29 5.0
1 petstages-orka-bone-dog-chew-toy $3.99 5.0
2 ethical-pet-skinneeez-forest-series $4.74 5.0
miniature poodle
index toy_link toy_id \
0 456 https://www.chewy.com/nylabone-durachew-s-shap... 43248
1 515 https://www.chewy.com/big-sky-antler-chews-nat... 51007
2 840 https://www.chewy.com/ruff-dawg-tug-toy-color-... 38938
toy_name price likely rating
0 nylabone-durachew-s-shape-bacon $12.99 5.0
1 big-sky-antler-chews-natural-elk $16.85 5.0
2 ruff-dawg-tug-toy-color-varies-super $8.49 5.0
miniature schnauzer
index toy_link toy_id \
0 355 https://www.chewy.com/nylabone-puppy-chew-teet... 39345
1 545 https://www.chewy.com/kong-wild-knots-bear-dog... 47882
2 556 https://www.chewy.com/multipet-musical-birthda... 53099
toy_name price likely rating
0 nylabone-puppy-chew-teething $5.08 5.0
1 kong-wild-knots-bear-dog-toy-color $7.49 5.0
2 multipet-musical-birthday-cake-plush $5.99 5.0
newfoundland
index toy_link toy_id \
0 281 https://www.chewy.com/jolly-pets-tug-n-toss-do... 102437
1 478 https://www.chewy.com/nylabone-nylaflex-wavy-a... 108504
2 553 https://www.chewy.com/kong-cozie-king-purple-h... 47738
toy_name price likely rating
0 jolly-pets-tug-n-toss-dog-toy $7.29 5.0
1 nylabone-nylaflex-wavy-arm-dog-chew $7.70 5.0
2 kong-cozie-king-purple-haired-lion $4.99 5.0
papillon
index toy_link toy_id \
0 80 https://www.chewy.com/kong-squeezz-ring-dog-to... 38531
1 259 https://www.chewy.com/ruff-dawg-stick-dog-toy-... 38929
2 566 https://www.chewy.com/outward-hound-replacemen... 113795
toy_name price likely rating
0 kong-squeezz-ring-dog-toy-color $6.59 5.0
1 ruff-dawg-stick-dog-toy-color-varies $11.99 5.0
2 outward-hound-replacement-squirrels $5.99 5.0
pomeranian
index toy_link toy_id \
0 344 https://www.chewy.com/jw-pet-play-place-butter... 108897
1 394 https://www.chewy.com/multipet-latex-polka-dot... 52983
2 425 https://www.chewy.com/jw-pet-nylon-dog-treat-p... 108924
toy_name price likely rating
0 jw-pet-play-place-butterfly-puppy $1.79 5.0
1 multipet-latex-polka-dot-globlet-pig $7.58 5.0
2 jw-pet-nylon-dog-treat-pod-toy-large $6.89 5.0
pug
index toy_link toy_id \
0 498 https://www.chewy.com/planet-dog-orbee-tuff-ra... 38746
1 688 https://www.chewy.com/multipet-look-whos-talki... 53038
2 707 https://www.chewy.com/kong-holiday-cozie-allig... 115725
toy_name price likely rating
0 planet-dog-orbee-tuff-raspberry $8.95 5.0
1 multipet-look-whos-talking-lobster $6.43 5.0
2 kong-holiday-cozie-alligator-dog-toy $12.14 5.0
rhodesian ridgeback
index toy_link toy_id \
0 1 https://www.chewy.com/mammoth-monkey-fist-bar-... 108582
1 128 https://www.chewy.com/west-paw-design-zogoflex... 43064
2 568 https://www.chewy.com/godog-checkers-chew-guar... 135127
toy_name price likely rating
0 mammoth-monkey-fist-bar-dog-toy $2.99 5.0
1 west-paw-design-zogoflex-zisc-dog $15.95 5.0
2 godog-checkers-chew-guard-donkey-dog $7.50 5.0
rottweiler
index toy_link toy_id \
0 45 https://www.chewy.com/rogz-grinz-treat-ball-do... 116749
1 307 https://www.chewy.com/busy-buddy-barnacle-dog-... 48172
2 778 https://www.chewy.com/busy-buddy-natural-rawhi... 48181
toy_name price likely rating
0 rogz-grinz-treat-ball-dog-toy-color $5.99 5.0
1 busy-buddy-barnacle-dog-toy-small $6.95 5.0
2 busy-buddy-natural-rawhide-peanut $7.49 5.0
samoyed
index toy_link toy_id \
0 181 https://www.chewy.com/kong-squeezz-football-do... 38507
1 508 https://www.chewy.com/tuffys-silly-squeakers-w... 39295
2 834 https://www.chewy.com/mammoth-snakebiter-snake... 110962
toy_name price likely rating
0 kong-squeezz-football-dog-toy-color $4.99 5.0
1 tuffys-silly-squeakers-wine-bottles $10.13 5.0
2 mammoth-snakebiter-snake-rope-dog $5.39 5.0
scottish terrier
index toy_link toy_id \
0 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
1 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
2 729 https://www.chewy.com/fat-cat-mini-terrible-na... 55485
toy_name price likely rating
0 west-paw-design-zogoflex-jive-dog $14.95 5.0
1 multipet-boingo-ball-dog-toy-color $9.43 5.0
2 fat-cat-mini-terrible-nasty-scaries $7.74 5.0
shetland sheepdog
index toy_link toy_id \
0 115 https://www.chewy.com/busy-buddy-puppy-squirre... 52120
1 521 https://www.chewy.com/jolly-pets-flathead-gira... 132590
2 726 https://www.chewy.com/jolly-pets-tug-mals-crab... 38701
toy_name price likely rating
0 busy-buddy-puppy-squirrel-dude-dog $4.95 5.0
1 jolly-pets-flathead-giraffe-dog-toy $11.99 5.0
2 jolly-pets-tug-mals-crab-dog-toy $9.99 5.0
shiba inu
index toy_link toy_id \
0 537 https://www.chewy.com/kong-cozie-baily-blue-do... 47734
1 616 https://www.chewy.com/kong-cozie-buster-koala-... 47735
2 669 https://www.chewy.com/fat-cat-terrible-nasty-s... 53540
toy_name price likely rating
0 kong-cozie-baily-blue-dog-toy $5.49 5.0
1 kong-cozie-buster-koala-dog-toy $5.49 5.0
2 fat-cat-terrible-nasty-scaries-dog $9.22 5.0
shih tzu
index toy_link toy_id \
0 17 https://www.chewy.com/gnawsome-squeaker-footba... 156822
1 48 https://www.chewy.com/chuckit-max-glow-ball-me... 117754
2 466 https://www.chewy.com/petstages-orka-bone-dog-... 46927
toy_name price likely rating
0 gnawsome-squeaker-football-dog-toy $2.99 5.0
1 chuckit-max-glow-ball-medium $4.19 5.0
2 petstages-orka-bone-dog-chew-toy $3.99 5.0
siberian husky
index toy_link toy_id \
0 345 https://www.chewy.com/nylabone-puppy-chew-star... 39341
1 346 https://www.chewy.com/kong-extreme-dog-toy-x-l... 38494
2 348 https://www.chewy.com/kong-extreme-goodie-bone... 118907
toy_name price likely rating
0 nylabone-puppy-chew-starter-kit $6.49 5.0
1 kong-extreme-dog-toy-x-large $9.29 5.0
2 kong-extreme-goodie-bone-dog-toy $8.53 5.0
soft coated wheaten terrier
index toy_link toy_id \
0 4 https://www.chewy.com/chuckit-ultra-rubber-bal... 38371
1 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
2 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
toy_name price likely rating
0 chuckit-ultra-rubber-ball-medium-2 $6.85 5.0
1 west-paw-design-zogoflex-jive-dog $14.95 5.0
2 multipet-boingo-ball-dog-toy-color $9.43 5.0
standard poodle
index toy_link toy_id \
0 214 https://www.chewy.com/tuffys-ocean-creatures-g... 39246
1 339 https://www.chewy.com/hartz-bug-eyes-dog-toy-c... 110661
2 606 https://www.chewy.com/kong-barnyard-cruncheez-... 118868
toy_name price likely rating
0 tuffys-ocean-creatures-gary-gator $20.25 5.0
1 hartz-bug-eyes-dog-toy-character $2.99 5.0
2 kong-barnyard-cruncheez-pig-dog-toy $7.60 5.0
tibetan mastiff
index toy_link toy_id \
0 101 https://www.chewy.com/jw-pet-isqueak-bouncin-b... 55933
1 111 https://www.chewy.com/jw-pet-hol-ee-football-d... 55897
2 456 https://www.chewy.com/nylabone-durachew-s-shap... 43248
toy_name price likely rating
0 jw-pet-isqueak-bouncin-bowlin-pin $7.99 5.0
1 jw-pet-hol-ee-football-dog-toy-color $6.44 5.0
2 nylabone-durachew-s-shape-bacon $12.99 5.0
toy poodle
index toy_link toy_id \
0 7 https://www.chewy.com/kong-airdog-squeakair-ba... 44145
1 459 https://www.chewy.com/nylabone-durachew-big-ch... 43354
2 720 https://www.chewy.com/zanies-croaker-dog-toy-m... 120254
toy_name price likely rating
0 kong-airdog-squeakair-balls-packs $2.59 5.0
1 nylabone-durachew-big-chew-chicken $13.62 5.0
2 zanies-croaker-dog-toy-medium $8.73 5.0
vizsla
index toy_link toy_id \
0 130 https://www.chewy.com/kong-duets-kibble-ball-d... 118878
1 267 https://www.chewy.com/planet-dog-glow-good-bal... 53267
2 793 https://www.chewy.com/planet-dog-orbee-tuff-sn... 103060
toy_name price likely rating
0 kong-duets-kibble-ball-dog-toy $5.63 5.0
1 planet-dog-glow-good-ball-dogs-3 $13.00 5.0
2 planet-dog-orbee-tuff-snoop-dog-toy $20.95 5.0
weimaraner
index toy_link toy_id \
0 279 https://www.chewy.com/planet-dog-orbee-tuff-sp... 47236
1 297 https://www.chewy.com/nerf-dog-rubber-football... 110101
2 534 https://www.chewy.com/kong-dynos-t-rex-dog-toy... 118890
toy_name price likely rating
0 planet-dog-orbee-tuff-sport-tennis $13.22 5.0
1 nerf-dog-rubber-football-dog-toy $11.99 5.0
2 kong-dynos-t-rex-dog-toy-large $5.16 5.0
west highland white terrier
index toy_link toy_id \
0 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
1 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
2 583 https://www.chewy.com/booda-soft-bite-medium-h... 55502
toy_name price likely rating
0 west-paw-design-zogoflex-jive-dog $14.95 5.0
1 multipet-boingo-ball-dog-toy-color $9.43 5.0
2 booda-soft-bite-medium-hot-dog-plush $4.80 5.0
wheaten terrier
index toy_link toy_id \
0 4 https://www.chewy.com/chuckit-ultra-rubber-bal... 38371
1 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
2 321 https://www.chewy.com/multipet-boingo-ball-dog... 52952
toy_name price likely rating
0 chuckit-ultra-rubber-ball-medium-2 $6.85 5.0
1 west-paw-design-zogoflex-jive-dog $14.95 5.0
2 multipet-boingo-ball-dog-toy-color $9.43 5.0
whippet
index toy_link toy_id \
0 315 https://www.chewy.com/tuffys-ocean-creatures-b... 57075
1 581 https://www.chewy.com/outward-hound-hedgehogz-... 113811
2 591 https://www.chewy.com/outward-hound-invincible... 113685
toy_name price likely rating
0 tuffys-ocean-creatures-burtle-turtle $14.23 5.0
1 outward-hound-hedgehogz-plush-dog $5.99 5.0
2 outward-hound-invincibles-minis-dog $3.29 5.0
yorkshire terrier
index toy_link toy_id \
0 4 https://www.chewy.com/chuckit-ultra-rubber-bal... 38371
1 124 https://www.chewy.com/booda-soft-bite-tail-spi... 55513
2 252 https://www.chewy.com/west-paw-design-zogoflex... 43048
toy_name price likely rating
0 chuckit-ultra-rubber-ball-medium-2 $6.85 5.0
1 booda-soft-bite-tail-spin-flyer $8.39 5.0
2 west-paw-design-zogoflex-jive-dog $14.95 5.0
In [164]:
save_data = df_scored_finalscore.to_csv(index=False)
s3_res = boto3.resource('s3')
s3_res.Bucket('dogfaces').put_object(Key='reviews/scored_breed_toy.csv', Body=save_data)
Out[164]:
s3.Object(bucket_name='dogfaces', key='reviews/scored_breed_toy.csv')
In [ ]:
Content source: sadahanu/Capstone
Similar notebooks: