Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- isbn title author year shelves
- 0 0380795272 Krondor: The Betrayal Raymond E. Feist 1998 [fantasy, raymond-e-feist, feist, epic-fantasy...
- 1 1416949658 The Dark Is Rising Susan Cooper 1973 [young-adult, fantasy, ya, childrens, series, ...
- 2 1857231082 The Black Unicorn Terry Brooks 1987 [fantasy, sci-fi-fantasy, series, magic, lando...
- 3 0553803700 I, Robot Isaac Asimov 1950 [science-fiction, sci-fi, classics, scifi, sho...
- 4 080213825X Four Blondes Candace Bushnell 2000 [chick-lit, chicklit, chic-lit, contemporary, ...
- 5 0375913750 Love, Stargirl Jerry Spinelli 2007 [young-adult, ya, realistic-fiction, romance, ...
- 6 074349671X The Tenth Circle Jodi Picoult 2006 [jodi-picoult, contemporary, chick-lit, adult-...
- 7 0743454553 Vanishing Acts Jodi Picoult 2005 [jodi-picoult, chick-lit, contemporary, drama,...
- 8 0765317508 Aztec Gary Jennings 1980 [historical-fiction, historical, history, mexi...
- 9 0142501085 Marlfox Brian Jacques 1998 [fantasy, redwall, young-adult, childrens, chi...
- def tanimoto_score(shelves_1, shelves_2):
- intersection_tanimoto = len([x for x in shelves_1 if x in shelves_2])
- union_tanimoto = len(shelves_1) + len(shelves_2)
- return(intersection_tanimoto/union_tanimoto)
- similarity_df = pd.DataFrame()
- # for each line we compare the tags
- for index_1,row_1 in data.iterrows():
- for index_2, row_2 in data.iterrows():
- similarity_score = tanimoto_score(data.at[index_1,'shelves'],data.at[index_2,'shelves'])
- similarity_df[data.at[index_1,'title'],data.at[index_2,'title']] = similarity_score
- (Krondor: The Betrayal, Krondor: The Betrayal) (Krondor: The Betrayal, The Dark Is Rising) (Krondor: The Betrayal, The Black Unicorn ) (Krondor: The Betrayal, I, Robot) (Krondor: The Betrayal, Four Blondes) (Krondor: The Betrayal, Love, Stargirl) (Krondor: The Betrayal, The Tenth Circle) (Krondor: The Betrayal, Vanishing Acts) (Krondor: The Betrayal, Aztec) (Krondor: The Betrayal, Marlfox) ... (Marlfox, Krondor: The Betrayal) (Marlfox, The Dark Is Rising) (Marlfox, The Black Unicorn ) (Marlfox, I, Robot) (Marlfox, Four Blondes) (Marlfox, Love, Stargirl) (Marlfox, The Tenth Circle) (Marlfox, Vanishing Acts) (Marlfox, Aztec) (Marlfox, Marlfox)
- 0 rows × 100 columns
- Krondor: The Betrayal The Dark Is Rising ...
- Krondor: The Betrayal 1 0.75
- The Dark Is Rising 0.75 1
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement