import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from numpy import int64
import warnings
warnings.filterwarnings("ignore")
import requests
import IPython.display as Disp
import plotly.express as px
import sklearn
from IPython.core.display import display,HTML
from sklearn.decomposition import TruncatedSVD
# Books data reading
book=pd.read_csv("C:Books.txt")
#Rating data reading
rating=pd.read_csv("C:Ratings.txt")
book.shape,rating.shape
((10000, 23), (162604, 3))
pd.set_option('display.max_columns',100)
book.head(3)
book_id | goodreads_book_id | best_book_id | work_id | books_count | isbn | isbn13 | authors | original_publication_year | original_title | title | language_code | average_rating | ratings_count | work_ratings_count | work_text_reviews_count | ratings_1 | ratings_2 | ratings_3 | ratings_4 | ratings_5 | image_url | small_image_url | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2767052 | 2767052 | 2792775 | 272 | 439023483 | 9.780439e+12 | Suzanne Collins | 2008.0 | The Hunger Games | The Hunger Games (The Hunger Games, #1) | eng | 4.34 | 4780653 | 4942365 | 155254 | 66715 | 127936 | 560092 | 1481305 | 2706317 | https://images.gr-assets.com/books/1447303603m... | https://images.gr-assets.com/books/1447303603s... |
1 | 2 | 3 | 3 | 4640799 | 491 | 439554934 | 9.780440e+12 | J.K. Rowling, Mary GrandPré | 1997.0 | Harry Potter and the Philosopher's Stone | Harry Potter and the Sorcerer's Stone (Harry P... | eng | 4.44 | 4602479 | 4800065 | 75867 | 75504 | 101676 | 455024 | 1156318 | 3011543 | https://images.gr-assets.com/books/1474154022m... | https://images.gr-assets.com/books/1474154022s... |
2 | 3 | 41865 | 41865 | 3212258 | 226 | 316015849 | 9.780316e+12 | Stephenie Meyer | 2005.0 | Twilight | Twilight (Twilight, #1) | en-US | 3.57 | 3866839 | 3916824 | 95009 | 456191 | 436802 | 793319 | 875073 | 1355439 | https://images.gr-assets.com/books/1361039443m... | https://images.gr-assets.com/books/1361039443s... |
rating.head(3)
user_id | book_id | rating | |
---|---|---|---|
0 | 1 | 258 | 5 |
1 | 2 | 4081 | 4 |
2 | 2 | 260 | 5 |
# Data merging done on common column i.e. book id
df=rating.merge(book,on='book_id')
df.head(2)
user_id | book_id | rating | goodreads_book_id | best_book_id | work_id | books_count | isbn | isbn13 | authors | original_publication_year | original_title | title | language_code | average_rating | ratings_count | work_ratings_count | work_text_reviews_count | ratings_1 | ratings_2 | ratings_3 | ratings_4 | ratings_5 | image_url | small_image_url | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 258 | 5 | 1232 | 1232 | 3209783 | 279 | 143034901 | 9.780143e+12 | Carlos Ruiz Zafón, Lucia Graves | 2001.0 | La sombra del viento | The Shadow of the Wind (The Cemetery of Forgot... | eng | 4.24 | 263685 | 317554 | 24652 | 4789 | 11769 | 42214 | 101612 | 157170 | https://images.gr-assets.com/books/1344545047m... | https://images.gr-assets.com/books/1344545047s... |
1 | 11 | 258 | 3 | 1232 | 1232 | 3209783 | 279 | 143034901 | 9.780143e+12 | Carlos Ruiz Zafón, Lucia Graves | 2001.0 | La sombra del viento | The Shadow of the Wind (The Cemetery of Forgot... | eng | 4.24 | 263685 | 317554 | 24652 | 4789 | 11769 | 42214 | 101612 | 157170 | https://images.gr-assets.com/books/1344545047m... | https://images.gr-assets.com/books/1344545047s... |
df.describe()
user_id | book_id | rating | goodreads_book_id | best_book_id | work_id | books_count | isbn13 | original_publication_year | average_rating | ratings_count | work_ratings_count | work_text_reviews_count | ratings_1 | ratings_2 | ratings_3 | ratings_4 | ratings_5 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 162604.000000 | 162604.000000 | 162604.000000 | 1.626040e+05 | 1.626040e+05 | 1.626040e+05 | 162604.000000 | 1.607660e+05 | 162579.000000 | 162604.000000 | 1.626040e+05 | 1.626040e+05 | 162604.000000 | 162604.00000 | 162604.000000 | 162604.000000 | 1.626040e+05 | 1.626040e+05 |
mean | 2085.741765 | 1772.377119 | 3.813184 | 1.333508e+05 | 4.646940e+05 | 2.359180e+06 | 305.715032 | 9.776478e+12 | 1945.111823 | 3.974965 | 4.176416e+05 | 4.464290e+05 | 10714.792059 | 11066.13202 | 22563.078842 | 77512.512386 | 1.404566e+05 | 1.948307e+05 |
std | 1212.894799 | 2361.275403 | 1.001269 | 9.495106e+05 | 2.865794e+06 | 4.224005e+06 | 503.339815 | 1.988365e+11 | 220.054157 | 0.254314 | 6.719332e+05 | 7.053673e+05 | 14638.133223 | 22737.33095 | 37251.600050 | 112010.698268 | 2.066473e+05 | 3.699612e+05 |
min | 1.000000 | 2.000000 | 1.000000 | 1.000000e+00 | 1.000000e+00 | 8.700000e+01 | 1.000000 | 1.951703e+08 | -1750.000000 | 2.470000 | 2.716000e+03 | 5.510000e+03 | 17.000000 | 11.00000 | 30.000000 | 323.000000 | 7.500000e+02 | 7.810000e+02 |
25% | 1037.000000 | 136.000000 | 3.000000 | 5.211000e+03 | 5.348000e+03 | 9.007640e+05 | 60.000000 | 9.780307e+12 | 1955.000000 | 3.820000 | 4.006300e+04 | 4.421500e+04 | 1587.000000 | 682.00000 | 2227.000000 | 9745.000000 | 1.580200e+04 | 1.414800e+04 |
50% | 2048.000000 | 680.000000 | 4.000000 | 1.493500e+04 | 1.588100e+04 | 1.758256e+06 | 114.000000 | 9.780440e+12 | 1989.000000 | 3.970000 | 1.310040e+05 | 1.423260e+05 | 4587.000000 | 2631.00000 | 7716.000000 | 29992.000000 | 4.949300e+04 | 4.757200e+04 |
75% | 3101.000000 | 2465.250000 | 5.000000 | 5.203600e+04 | 6.496000e+04 | 2.977639e+06 | 283.000000 | 9.780685e+12 | 2000.000000 | 4.140000 | 4.698360e+05 | 5.105820e+05 | 13050.000000 | 10381.00000 | 24094.000000 | 93427.000000 | 1.654770e+05 | 1.875690e+05 |
max | 5518.000000 | 10000.000000 | 5.000000 | 1.974776e+07 | 3.360215e+07 | 5.639960e+07 | 3455.000000 | 9.790008e+12 | 2014.000000 | 4.820000 | 4.602479e+06 | 4.800065e+06 | 95009.000000 | 456191.00000 | 436802.000000 | 793319.000000 | 1.156318e+06 | 3.011543e+06 |
df.info()
<class 'pandas.core.frame.DataFrame'> Int64Index: 162604 entries, 0 to 162603 Data columns (total 25 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 user_id 162604 non-null int64 1 book_id 162604 non-null int64 2 rating 162604 non-null int64 3 goodreads_book_id 162604 non-null int64 4 best_book_id 162604 non-null int64 5 work_id 162604 non-null int64 6 books_count 162604 non-null int64 7 isbn 160413 non-null object 8 isbn13 160766 non-null float64 9 authors 162604 non-null object 10 original_publication_year 162579 non-null float64 11 original_title 160786 non-null object 12 title 162604 non-null object 13 language_code 151898 non-null object 14 average_rating 162604 non-null float64 15 ratings_count 162604 non-null int64 16 work_ratings_count 162604 non-null int64 17 work_text_reviews_count 162604 non-null int64 18 ratings_1 162604 non-null int64 19 ratings_2 162604 non-null int64 20 ratings_3 162604 non-null int64 21 ratings_4 162604 non-null int64 22 ratings_5 162604 non-null int64 23 image_url 162604 non-null object 24 small_image_url 162604 non-null object dtypes: float64(3), int64(15), object(7) memory usage: 32.3+ MB
df.isna().sum()
user_id 0 book_id 0 rating 0 goodreads_book_id 0 best_book_id 0 work_id 0 books_count 0 isbn 2191 isbn13 1838 authors 0 original_publication_year 25 original_title 1818 title 0 language_code 10706 average_rating 0 ratings_count 0 work_ratings_count 0 work_text_reviews_count 0 ratings_1 0 ratings_2 0 ratings_3 0 ratings_4 0 ratings_5 0 image_url 0 small_image_url 0 dtype: int64
#Filling null values of original_title with Na and 0
df['original_title']=df['original_title'].fillna('Na')
df['original_publication_year']=df['original_publication_year'].fillna(0)
#Since, all columns of data are not required. So, extracting the columns that are only necessary
dfuse=df[['user_id','book_id','rating','books_count','original_publication_year','average_rating','ratings_count','title','original_title','authors','image_url']]
dfuse.head(3)
user_id | book_id | rating | books_count | original_publication_year | average_rating | ratings_count | title | original_title | authors | image_url | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 258 | 5 | 279 | 2001.0 | 4.24 | 263685 | The Shadow of the Wind (The Cemetery of Forgot... | La sombra del viento | Carlos Ruiz Zafón, Lucia Graves | https://images.gr-assets.com/books/1344545047m... |
1 | 11 | 258 | 3 | 279 | 2001.0 | 4.24 | 263685 | The Shadow of the Wind (The Cemetery of Forgot... | La sombra del viento | Carlos Ruiz Zafón, Lucia Graves | https://images.gr-assets.com/books/1344545047m... |
2 | 143 | 258 | 4 | 279 | 2001.0 | 4.24 | 263685 | The Shadow of the Wind (The Cemetery of Forgot... | La sombra del viento | Carlos Ruiz Zafón, Lucia Graves | https://images.gr-assets.com/books/1344545047m... |
px.bar(dfuse.groupby('rating')['book_id'].count(), title='Plot of Rating with Books Count',color_discrete_sequence =['green']*3, height=500, width=700)
As shown here, maximum rating of 4 are given 58.821K times where rating 5 are given 46.31K. Least rating given is 1 to only 3633. This shows given in data are good books since rating 3 are 4 times given than rating 2.
px.bar(dfuse.groupby('book_id')['rating'].count().sort_values(ascending=False).nlargest(5), title='Plot of Top 5 Highly Rated in Counts',color_discrete_sequence =['light blue']*3, height=500, width=700 )
As shown maximum rating count is of book id 26 with 1010 count followed by count of 922 of book id of 2 and 4.
px.bar(dfuse.groupby(str('title'))['average_rating'].mean().sort_values(ascending=False).nlargest(5), title='Plot of Top 3 Highly Rated Books on Basis of Average Ratings',color_discrete_sequence =['red']*3,height=500, width=700 )
As shown above, highest rating average of 4.82 is given to book "The Complete Calvin and Hobbies" followed by rating of 4.77 to Harry Potter(1-5)
px.bar(dfuse.groupby(str('user_id'))['rating'].count().sort_values(ascending=False).nlargest(10), title='Plot of User Id with Ratings Count',color_discrete_sequence =['orange']*3 , height=500, width=700)
As shown above, user id of 2276 rated maximum books of 185 in count followed by value of 179 by user if 4147 then value of 172 with user id 1794
df_1=pd.DataFrame(dfuse.groupby('original_title')['rating'].count().sort_values(ascending=False).nlargest(6))
df_1['Image']=" "
def path_to_image_html(path):
return '<img src="'+ path + '" width="60" >'
for i in range(1,len(df_1.index)):
url=dfuse[dfuse['original_title']==df_1.index[i]]['image_url'].unique()
df_1['Image'][i]=url[0]
image_cols = ['Image']
# Create the dictionariy to be passed as formatters
format_dict = {}
for image_col in image_cols:
format_dict[image_col] = path_to_image_html
display(HTML(df_1[1:].to_html(escape=False ,formatters=format_dict)))
rating | Image | |
---|---|---|
original_title | ||
The Da Vinci Code | 1010 | ![]() |
To Kill a Mockingbird | 922 | ![]() |
Harry Potter and the Philosopher's Stone | 922 | ![]() |
The Catcher in the Rye | 883 | ![]() |
Harry Potter and the Prisoner of Azkaban | 883 | ![]() |
As given in above dataframe, "The Da Vinci Code" has the maximum rating count of 1010 haing book id 26 as mentioned in Q2
# create pivot table to study the user and book relation
df_pivot=dfuse.pivot_table(values='rating',index='user_id',columns='original_title',fill_value=0)
df_pivot.head(5)
original_title | Animal Farm & 1984 | Burned (Burned, #1) | Carter Beats the Devil | De Imitatione Christi | Faust. Der Tragödie erster und zweiter Teil | Feeling Good: The New Mood Therapy | Innocent Traitor | The Fellowship of the Ring | The Sea of Trolls | The Tale of Despereaux | Игрок | الرحيق المختوم: بحث في السيرة النبوية على صاحبها أفضل الصلاة والسلام | سمفونی مردگان | めくらやなぎと、眠る女 [Mekurayanagi to, nemuru onna] | 国境の南、太陽の西 [Kokkyō no minami, taiyō no nishi] | 絶対彼氏 (Zettai Kareshi) 1 | "...And Ladies of the Club" | "D" is for Deadbeat | "M" is for Malice | "N" is for Noose | "O" is for Outlaw | "P" is for Peril | "Q" is for Quarry | 'Tis: A Memoir | ... Then He Ate My Boy Entracers | ...and that's when it fell off in my hand | 1,000 Places to See Before You Die | 100 Bullets, Vol. 1: First Shot, Last Call (100 bullets, #1) | 100 Selected Poems by e. e. Cummings | 13 Little Blue Envelopes | 1421: The Year China Discovered America | 1491: New Revelations of the Americas Before Columbus | 16 Lighthouse Road | 1776 | 1st To Die | 2001: A Space Odyssey | 2010: Odyssey Two | 204 Rosewood Lane | 2061: Odyssey Three | 20th Century Ghosts | 2666 | 2nd Chance | 30 Days of Night | 300 | 3001: The Final Odyssey | 31 Songs | 3rd Degree | 4.50 From Paddington | 44 Scotland Street | ... | デスノート #2 (Desu Nōto) Gōryū (合流) | デスノート #3 (Desu Nōto) Gekisō (激走) | デスノート #4 (Desu Nōto) Koigokoro (恋心) | デスノート #5 (Desu Nōto) Hakushi (白紙,) | デスノート #6 (Desu Nōto) Kōkan (交換) | デスノート #7 (Desu Nōto) Zero (零) | デスノート #8 (Desu Nōto) Mato (的) | ノルウェイの森 [Noruwei no Mori] | バトル・ロワイアル | フルーツバスケット 1 | フルーツバスケット 14 | フルーツバスケット 15 | フルーツバスケット 2 | フルーツバスケット 3 | フルーツバスケット 4 | フルーツバスケット 7 | マース (Mars) #1 | ヤマトナデシコ七変化 | ラブひな #1 | ヴァンパイア騎士 1 | ヴァンパイア騎士 2 | ヴァンパイア騎士 3 | ヴァンパイア騎士 4 | 世界の終りとハードボイルド・ワンダーランド [Sekai no owari to hādoboirudo wandārando] | 五輪書 [Go Rin no Sho] | 午後の曳航 [Gogo no eikō] | 名探偵コナン 1 | 孫子兵法 [Sūnzi bīngfǎ] | 宮本武蔵 Miyamoto Musashi | 易 [Yì] | 桜蘭高校ホスト部 1 | 桜蘭高校ホスト部 2 | 桜蘭高校ホスト部 3 | 桜蘭高校ホスト部 4 | 沈黙 | 海辺のカフカ [Umibe no Kafuka] | 満月をさがして 1 | 犬夜叉 1 | 砂の女 [Suna no onna] | 神の子どもたちはみな踊る | 窓ぎわのトットちゃん | 紳士同盟† 1 | 羊をめぐる冒険 [Hitsujiwomegurubōken] | 美少女戦士セーラームーン 1 [Bishōjo Senshi Sailor Moon 1] | 花より男子 1 | 論語 [Lún Yǔ] | 象の消滅 [Zō no shōmetsu] | 道德經 [dào dé jīng] | 鋼の錬金術師 1 | 雪国 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
user_id | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | 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 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 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 | 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 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 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 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 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 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
6 | 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 | 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 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
5 rows × 5286 columns
# Transposing the pivot table to easy access
x=df_pivot.values.T
x.shape
(5286, 2780)
SVD = TruncatedSVD(n_components=20, random_state=17)
result_matrix = SVD.fit_transform(x)
result_matrix.shape
(5286, 20)
corr_mat = np.corrcoef(result_matrix)
corr_mat.shape
(5286, 5286)
book_names = df_pivot.columns
book_list = list(book_names)
book_index = book_list.index(' Innocent Traitor')
corr_book = corr_mat[book_index]
corr_book.shape
(5286,)
print("Recommendation are")
list(book_names[(corr_book<1.0) & (corr_book>0.8)][1:])
Recommendation are
['A Tree Grows In Brooklyn ', 'Breathing Lessons', 'Drowning Ruth', "French Women Don't Get Fat", 'Girl with a Pearl Earring', 'September', 'The Accidental Tourist', "The Bonesetter's Daughter", 'The Joy Luck Club', 'The Last Days of Dogtown', 'The Prince of Tides', 'We Were the Mulvaneys', 'Winter Solstice']
def path_to_image_html(path):
return '<img src="'+ path + '" width="60" >'
def df_recommend(recommend):
recommend=recommend[:5]
year=[]
image_url=[]
for i in recommend:
for j in dfuse.index:
if dfuse['original_title'][j]==i:
year.append(dfuse['original_publication_year'][j])
image_url.append(dfuse['image_url'][j])
break
recommend_df=pd.DataFrame([recommend,year,image_url]).T
recommend_df.columns=['Recommend Books','Year of Publication','Image']
image_cols = ['Image']
format_dict = {}
for image_col in image_cols:
format_dict[image_col] = path_to_image_html
display(HTML(recommend_df[0:10].to_html(escape=False ,formatters=format_dict)))
def recommend_book(df_pivot, corr_mat):
name=input("Enter the Name of the Book : ")
book_names = df_pivot.columns
book_list = list(book_names)
try:
if name in book_list:
book_index = book_list.index(name)
corr_book = corr_mat[book_index]
print("Recommendation are")
recommend=list(book_names[(corr_book<1.0) & (corr_book>0.8)][1:])
df_recommend(recommend)
else:
name=" "+name
book_index = book_list.index(name)
corr_book = corr_mat[book_index]
print("Recommendation are")
recommend=list(book_names[(corr_book<1.0) & (corr_book>0.8)][1:])
df_recommend(recommend)
except:
print("Enter the Book Name Again")
recommend_book(df_pivot,corr_mat)
recommend_book(df_pivot,corr_mat)
Enter the Name of the Book : The Prince of Tides Recommendation are
Recommend Books | Year of Publication | Image | |
---|---|---|---|
0 | A Tree Grows In Brooklyn | 1943 | ![]() |
1 | All Over But the Shoutin' | 1997 | ![]() |
2 | Angela's Ashes: A Memoir | 1996 | ![]() |
3 | Back When We Were Grownups | 2001 | ![]() |
4 | Beach Music | 1975 | ![]() |