{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "33453ac6", "metadata": { "id": "33453ac6" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 3, "id": "hMTEA3T_cthv", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "hMTEA3T_cthv", "outputId": "6caa6894-32ce-4189-c48e-be0e3ecaadaf" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_30447/614938955.py:3: DtypeWarning: Columns (3) have mixed types. Specify dtype option on import or set low_memory=False.\n", " book = Users = pd.read_csv(\"/home/ayush/Documents/AI/Machine_Learning/Projects/RecommendationYourself/Data/BookDataset/Books_modified.csv\")\n" ] } ], "source": [ "ratings = pd.read_csv(\"/home/ayush/Documents/AI/Machine_Learning/Projects/RecommendationYourself/Data/BookDataset/Ratings.csv\")\n", "Users = pd.read_csv(\"/home/ayush/Documents/AI/Machine_Learning/Projects/RecommendationYourself/Data/BookDataset/Users.csv\")\n", "book = Users = pd.read_csv(\"/home/ayush/Documents/AI/Machine_Learning/Projects/RecommendationYourself/Data/BookDataset/Books_modified.csv\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "cea1365a", "metadata": {}, "outputs": [], "source": [ "book['Image-URL-M'] = book['Image-URL-M'].str.replace('http://', 'https://', regex=False)\n", "book.to_csv(\"/home/ayush/Documents/AI/Machine_Learning/Projects/RecommendationYourself/Data/BookDataset/Books_modified.csv\", index=False)" ] }, { "cell_type": "code", "execution_count": 5, "id": "cB2RB_C1c_SO", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "cB2RB_C1c_SO", "outputId": "5e9c2b20-1e69-4b4e-a605-1e619c77feeb" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "book : (271360, 8)\n", "rating : (1149780, 3)\n", "Users : (271360, 8)\n" ] } ], "source": [ "attri =[(\"book\",book),(\"rating\",ratings),(\"Users\",Users)]\n", "\n", "def shapeB(attri):\n", " for name,dt in attri:\n", " print(f\"{name} : {dt.shape}\")\n", "\n", "shapeB(attri)\n", "\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "XhGYhwjszuWI", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 178 }, "id": "XhGYhwjszuWI", "outputId": "7afcf57a-e938-4a74-d6f8-438b28016348" }, "outputs": [ { "data": { "text/plain": [ "ISBN 0\n", "Book-Title 0\n", "Book-Author 2\n", "Year-Of-Publication 0\n", "Publisher 2\n", "Image-URL-S 0\n", "Image-URL-M 0\n", "Image-URL-L 3\n", "dtype: int64" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ratings.isnull().sum()\n", "book.isnull().sum()\n", "Users.isnull().sum()\n", "\n" ] }, { "cell_type": "code", "execution_count": 7, "id": "XbKRRbTT4GyS", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "XbKRRbTT4GyS", "outputId": "b915581e-0263-4542-a9d2-844740606c80" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
User-IDISBNBook-Rating
0276725034545104X0
127672601550612245
227672704465208020
3276729052165615X3
427672905217950286
\n", "
" ], "text/plain": [ " User-ID ISBN Book-Rating\n", "0 276725 034545104X 0\n", "1 276726 0155061224 5\n", "2 276727 0446520802 0\n", "3 276729 052165615X 3\n", "4 276729 0521795028 6" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ratings.head()" ] }, { "cell_type": "code", "execution_count": 8, "id": "BHO_70mY6CKX", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "BHO_70mY6CKX", "outputId": "58c62bb7-b813-4d37-9188-5811f990f0d8" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ISBNBook-TitleBook-AuthorYear-Of-PublicationPublisherImage-URL-SImage-URL-MImage-URL-L
00195153448Classical MythologyMark P. O. Morford2002Oxford University Presshttp://images.amazon.com/images/P/0195153448.0...https://images.amazon.com/images/P/0195153448....http://images.amazon.com/images/P/0195153448.0...
10002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...
20060973129Decision in NormandyCarlo D'Este1991HarperPerennialhttp://images.amazon.com/images/P/0060973129.0...https://images.amazon.com/images/P/0060973129....http://images.amazon.com/images/P/0060973129.0...
30374157065Flu: The Story of the Great Influenza Pandemic...Gina Bari Kolata1999Farrar Straus Girouxhttp://images.amazon.com/images/P/0374157065.0...https://images.amazon.com/images/P/0374157065....http://images.amazon.com/images/P/0374157065.0...
40393045218The Mummies of UrumchiE. J. W. Barber1999W. W. Norton & Companyhttp://images.amazon.com/images/P/0393045218.0...https://images.amazon.com/images/P/0393045218....http://images.amazon.com/images/P/0393045218.0...
\n", "
" ], "text/plain": [ " ISBN Book-Title \\\n", "0 0195153448 Classical Mythology \n", "1 0002005018 Clara Callan \n", "2 0060973129 Decision in Normandy \n", "3 0374157065 Flu: The Story of the Great Influenza Pandemic... \n", "4 0393045218 The Mummies of Urumchi \n", "\n", " Book-Author Year-Of-Publication Publisher \\\n", "0 Mark P. O. Morford 2002 Oxford University Press \n", "1 Richard Bruce Wright 2001 HarperFlamingo Canada \n", "2 Carlo D'Este 1991 HarperPerennial \n", "3 Gina Bari Kolata 1999 Farrar Straus Giroux \n", "4 E. J. W. Barber 1999 W. W. Norton & Company \n", "\n", " Image-URL-S \\\n", "0 http://images.amazon.com/images/P/0195153448.0... \n", "1 http://images.amazon.com/images/P/0002005018.0... \n", "2 http://images.amazon.com/images/P/0060973129.0... \n", "3 http://images.amazon.com/images/P/0374157065.0... \n", "4 http://images.amazon.com/images/P/0393045218.0... \n", "\n", " Image-URL-M \\\n", "0 https://images.amazon.com/images/P/0195153448.... \n", "1 https://images.amazon.com/images/P/0002005018.... \n", "2 https://images.amazon.com/images/P/0060973129.... \n", "3 https://images.amazon.com/images/P/0374157065.... \n", "4 https://images.amazon.com/images/P/0393045218.... \n", "\n", " Image-URL-L \n", "0 http://images.amazon.com/images/P/0195153448.0... \n", "1 http://images.amazon.com/images/P/0002005018.0... \n", "2 http://images.amazon.com/images/P/0060973129.0... \n", "3 http://images.amazon.com/images/P/0374157065.0... \n", "4 http://images.amazon.com/images/P/0393045218.0... " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Users.head()" ] }, { "cell_type": "code", "execution_count": 9, "id": "VzdHAHHcIRrR", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 310 }, "id": "VzdHAHHcIRrR", "outputId": "a39aa320-c154-42e5-b7be-d8032a25eab9" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ISBNBook-TitleBook-AuthorYear-Of-PublicationPublisherImage-URL-SImage-URL-MImage-URL-L
00195153448Classical MythologyMark P. O. Morford2002Oxford University Presshttp://images.amazon.com/images/P/0195153448.0...https://images.amazon.com/images/P/0195153448....http://images.amazon.com/images/P/0195153448.0...
10002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...
20060973129Decision in NormandyCarlo D'Este1991HarperPerennialhttp://images.amazon.com/images/P/0060973129.0...https://images.amazon.com/images/P/0060973129....http://images.amazon.com/images/P/0060973129.0...
30374157065Flu: The Story of the Great Influenza Pandemic...Gina Bari Kolata1999Farrar Straus Girouxhttp://images.amazon.com/images/P/0374157065.0...https://images.amazon.com/images/P/0374157065....http://images.amazon.com/images/P/0374157065.0...
40393045218The Mummies of UrumchiE. J. W. Barber1999W. W. Norton & Companyhttp://images.amazon.com/images/P/0393045218.0...https://images.amazon.com/images/P/0393045218....http://images.amazon.com/images/P/0393045218.0...
\n", "
" ], "text/plain": [ " ISBN Book-Title \\\n", "0 0195153448 Classical Mythology \n", "1 0002005018 Clara Callan \n", "2 0060973129 Decision in Normandy \n", "3 0374157065 Flu: The Story of the Great Influenza Pandemic... \n", "4 0393045218 The Mummies of Urumchi \n", "\n", " Book-Author Year-Of-Publication Publisher \\\n", "0 Mark P. O. Morford 2002 Oxford University Press \n", "1 Richard Bruce Wright 2001 HarperFlamingo Canada \n", "2 Carlo D'Este 1991 HarperPerennial \n", "3 Gina Bari Kolata 1999 Farrar Straus Giroux \n", "4 E. J. W. Barber 1999 W. W. Norton & Company \n", "\n", " Image-URL-S \\\n", "0 http://images.amazon.com/images/P/0195153448.0... \n", "1 http://images.amazon.com/images/P/0002005018.0... \n", "2 http://images.amazon.com/images/P/0060973129.0... \n", "3 http://images.amazon.com/images/P/0374157065.0... \n", "4 http://images.amazon.com/images/P/0393045218.0... \n", "\n", " Image-URL-M \\\n", "0 https://images.amazon.com/images/P/0195153448.... \n", "1 https://images.amazon.com/images/P/0002005018.... \n", "2 https://images.amazon.com/images/P/0060973129.... \n", "3 https://images.amazon.com/images/P/0374157065.... \n", "4 https://images.amazon.com/images/P/0393045218.... \n", "\n", " Image-URL-L \n", "0 http://images.amazon.com/images/P/0195153448.0... \n", "1 http://images.amazon.com/images/P/0002005018.0... \n", "2 http://images.amazon.com/images/P/0060973129.0... \n", "3 http://images.amazon.com/images/P/0374157065.0... \n", "4 http://images.amazon.com/images/P/0393045218.0... " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "book.head()" ] }, { "cell_type": "code", "execution_count": 10, "id": "dMN_FjmjIzd-", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 615 }, "id": "dMN_FjmjIzd-", "outputId": "706e278b-2fe8-494b-b8b3-9d4dd01c7423" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ISBNBook-TitleBook-AuthorYear-Of-PublicationPublisherImage-URL-SImage-URL-MImage-URL-LUser-IDBook-Rating
00195153448Classical MythologyMark P. O. Morford2002Oxford University Presshttp://images.amazon.com/images/P/0195153448.0...https://images.amazon.com/images/P/0195153448....http://images.amazon.com/images/P/0195153448.0...20
10002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...85
20002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...114000
30002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...116768
40002005018Clara CallanRichard Bruce Wright2001HarperFlamingo Canadahttp://images.amazon.com/images/P/0002005018.0...https://images.amazon.com/images/P/0002005018....http://images.amazon.com/images/P/0002005018.0...413850
.................................
10311310440400988There's a Bat in Bunk FivePaula Danziger1988Random House Childrens Pub (Mm)http://images.amazon.com/images/P/0440400988.0...https://images.amazon.com/images/P/0440400988....http://images.amazon.com/images/P/0440400988.0...2764637
10311320525447644From One to One HundredTeri Sloat1991Dutton Bookshttp://images.amazon.com/images/P/0525447644.0...https://images.amazon.com/images/P/0525447644....http://images.amazon.com/images/P/0525447644.0...2765794
1031133006008667XLily Dale : The True Story of the Town that Ta...Christine Wicker2004HarperSanFranciscohttp://images.amazon.com/images/P/006008667X.0...https://images.amazon.com/images/P/006008667X....http://images.amazon.com/images/P/006008667X.0...2766800
10311340192126040Republic (World's Classics)Plato1996Oxford University Presshttp://images.amazon.com/images/P/0192126040.0...https://images.amazon.com/images/P/0192126040....http://images.amazon.com/images/P/0192126040.0...2766800
10311350767409752A Guided Tour of Rene Descartes' Meditations o...Christopher Biffle2000McGraw-Hill Humanities/Social Sciences/Languageshttp://images.amazon.com/images/P/0767409752.0...https://images.amazon.com/images/P/0767409752....http://images.amazon.com/images/P/0767409752.0...2766800
\n", "

1031136 rows × 10 columns

\n", "
" ], "text/plain": [ " ISBN Book-Title \\\n", "0 0195153448 Classical Mythology \n", "1 0002005018 Clara Callan \n", "2 0002005018 Clara Callan \n", "3 0002005018 Clara Callan \n", "4 0002005018 Clara Callan \n", "... ... ... \n", "1031131 0440400988 There's a Bat in Bunk Five \n", "1031132 0525447644 From One to One Hundred \n", "1031133 006008667X Lily Dale : The True Story of the Town that Ta... \n", "1031134 0192126040 Republic (World's Classics) \n", "1031135 0767409752 A Guided Tour of Rene Descartes' Meditations o... \n", "\n", " Book-Author Year-Of-Publication \\\n", "0 Mark P. O. Morford 2002 \n", "1 Richard Bruce Wright 2001 \n", "2 Richard Bruce Wright 2001 \n", "3 Richard Bruce Wright 2001 \n", "4 Richard Bruce Wright 2001 \n", "... ... ... \n", "1031131 Paula Danziger 1988 \n", "1031132 Teri Sloat 1991 \n", "1031133 Christine Wicker 2004 \n", "1031134 Plato 1996 \n", "1031135 Christopher Biffle 2000 \n", "\n", " Publisher \\\n", "0 Oxford University Press \n", "1 HarperFlamingo Canada \n", "2 HarperFlamingo Canada \n", "3 HarperFlamingo Canada \n", "4 HarperFlamingo Canada \n", "... ... \n", "1031131 Random House Childrens Pub (Mm) \n", "1031132 Dutton Books \n", "1031133 HarperSanFrancisco \n", "1031134 Oxford University Press \n", "1031135 McGraw-Hill Humanities/Social Sciences/Languages \n", "\n", " Image-URL-S \\\n", "0 http://images.amazon.com/images/P/0195153448.0... \n", "1 http://images.amazon.com/images/P/0002005018.0... \n", "2 http://images.amazon.com/images/P/0002005018.0... \n", "3 http://images.amazon.com/images/P/0002005018.0... \n", "4 http://images.amazon.com/images/P/0002005018.0... \n", "... ... \n", "1031131 http://images.amazon.com/images/P/0440400988.0... \n", "1031132 http://images.amazon.com/images/P/0525447644.0... \n", "1031133 http://images.amazon.com/images/P/006008667X.0... \n", "1031134 http://images.amazon.com/images/P/0192126040.0... \n", "1031135 http://images.amazon.com/images/P/0767409752.0... \n", "\n", " Image-URL-M \\\n", "0 https://images.amazon.com/images/P/0195153448.... \n", "1 https://images.amazon.com/images/P/0002005018.... \n", "2 https://images.amazon.com/images/P/0002005018.... \n", "3 https://images.amazon.com/images/P/0002005018.... \n", "4 https://images.amazon.com/images/P/0002005018.... \n", "... ... \n", "1031131 https://images.amazon.com/images/P/0440400988.... \n", "1031132 https://images.amazon.com/images/P/0525447644.... \n", "1031133 https://images.amazon.com/images/P/006008667X.... \n", "1031134 https://images.amazon.com/images/P/0192126040.... \n", "1031135 https://images.amazon.com/images/P/0767409752.... \n", "\n", " Image-URL-L User-ID \\\n", "0 http://images.amazon.com/images/P/0195153448.0... 2 \n", "1 http://images.amazon.com/images/P/0002005018.0... 8 \n", "2 http://images.amazon.com/images/P/0002005018.0... 11400 \n", "3 http://images.amazon.com/images/P/0002005018.0... 11676 \n", "4 http://images.amazon.com/images/P/0002005018.0... 41385 \n", "... ... ... \n", "1031131 http://images.amazon.com/images/P/0440400988.0... 276463 \n", "1031132 http://images.amazon.com/images/P/0525447644.0... 276579 \n", "1031133 http://images.amazon.com/images/P/006008667X.0... 276680 \n", "1031134 http://images.amazon.com/images/P/0192126040.0... 276680 \n", "1031135 http://images.amazon.com/images/P/0767409752.0... 276680 \n", "\n", " Book-Rating \n", "0 0 \n", "1 5 \n", "2 0 \n", "3 8 \n", "4 0 \n", "... ... \n", "1031131 7 \n", "1031132 4 \n", "1031133 0 \n", "1031134 0 \n", "1031135 0 \n", "\n", "[1031136 rows x 10 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Populatiy Bases Recommendation system\n", "\n", "\n", "# merging book and rating using ISBN\n", "merge_bookRating = book.merge(ratings,on=\"ISBN\")\n", "\n", "# Convert 'Book-Rating' to numeric, coercing errors to NaN\n", "merge_bookRating[\"Book-Rating\"] = pd.to_numeric(merge_bookRating[\"Book-Rating\"], errors='coerce')\n", "merge_bookRating\n" ] }, { "cell_type": "code", "execution_count": 11, "id": "NCc7Nj-TWMOX", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "NCc7Nj-TWMOX", "outputId": "0881692b-5c01-4e4d-9781-0a4629bf82ac" }, "outputs": [ { "data": { "text/plain": [ "array([ 0, 5, 8, 9, 7, 6, 10, 4, 3, 2, 1])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# merge_bookRating[\"Book-Rating\"].nunique()\n", "merge_bookRating[\"Book-Rating\"].unique()\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "1A3VJArtW_Pu", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "1A3VJArtW_Pu", "outputId": "7b75adff-b437-45ea-c243-1c4cf63dcce6" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Book-Titlenum-Rating
0A Light in the Storm: The Civil War Diary of ...4
1Always Have Popsicles1
2Apple Magic (The Collector's series)1
3Ask Lily (Young Women of Faith: Lily Series, ...1
4Beyond IBM: Leadership Marketing and Finance ...1
.........
241066Ã?Â?lpiraten.2
241067Ã?Â?rger mit Produkt X. Roman.4
241068Ã?Â?sterlich leben.1
241069Ã?Â?stlich der Berge.3
241070Ã?Â?thique en toc2
\n", "

241071 rows × 2 columns

\n", "
" ], "text/plain": [ " Book-Title num-Rating\n", "0 A Light in the Storm: The Civil War Diary of ... 4\n", "1 Always Have Popsicles 1\n", "2 Apple Magic (The Collector's series) 1\n", "3 Ask Lily (Young Women of Faith: Lily Series, ... 1\n", "4 Beyond IBM: Leadership Marketing and Finance ... 1\n", "... ... ...\n", "241066 Ã?Â?lpiraten. 2\n", "241067 Ã?Â?rger mit Produkt X. Roman. 4\n", "241068 Ã?Â?sterlich leben. 1\n", "241069 Ã?Â?stlich der Berge. 3\n", "241070 Ã?Â?thique en toc 2\n", "\n", "[241071 rows x 2 columns]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ratingCount = merge_bookRating.groupby(\"Book-Title\").count()[\"Book-Rating\"].reset_index()\n", "ratingCount.rename(columns={\"Book-Rating\":\"num-Rating\"})" ] }, { "cell_type": "code", "execution_count": 13, "id": "teQcRG1srHDN", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "teQcRG1srHDN", "outputId": "0da47b59-2bda-43bd-f6ba-8cb0f9b9d7e9" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Book-Titleavg-Rating
0A Light in the Storm: The Civil War Diary of ...2.250000
1Always Have Popsicles0.000000
2Apple Magic (The Collector's series)0.000000
3Ask Lily (Young Women of Faith: Lily Series, ...8.000000
4Beyond IBM: Leadership Marketing and Finance ...0.000000
.........
241066Ã?Â?lpiraten.0.000000
241067Ã?Â?rger mit Produkt X. Roman.5.250000
241068Ã?Â?sterlich leben.7.000000
241069Ã?Â?stlich der Berge.2.666667
241070Ã?Â?thique en toc4.000000
\n", "

241071 rows × 2 columns

\n", "
" ], "text/plain": [ " Book-Title avg-Rating\n", "0 A Light in the Storm: The Civil War Diary of ... 2.250000\n", "1 Always Have Popsicles 0.000000\n", "2 Apple Magic (The Collector's series) 0.000000\n", "3 Ask Lily (Young Women of Faith: Lily Series, ... 8.000000\n", "4 Beyond IBM: Leadership Marketing and Finance ... 0.000000\n", "... ... ...\n", "241066 Ã?Â?lpiraten. 0.000000\n", "241067 Ã?Â?rger mit Produkt X. Roman. 5.250000\n", "241068 Ã?Â?sterlich leben. 7.000000\n", "241069 Ã?Â?stlich der Berge. 2.666667\n", "241070 Ã?Â?thique en toc 4.000000\n", "\n", "[241071 rows x 2 columns]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "avg_ratingCount = merge_bookRating.groupby(\"Book-Title\")[\"Book-Rating\"].mean().reset_index()\n", "avg_ratingCount.rename(columns={\"Book-Rating\": \"avg-Rating\"}, inplace=True)\n", "avg_ratingCount" ] }, { "cell_type": "code", "execution_count": 14, "id": "L9SWHaxwtJNx", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "L9SWHaxwtJNx", "outputId": "ac433e79-ece3-4504-ecae-b4db235534e7" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Book-TitleBook-Ratingavg-Rating
0A Light in the Storm: The Civil War Diary of ...42.250000
1Always Have Popsicles10.000000
2Apple Magic (The Collector's series)10.000000
3Ask Lily (Young Women of Faith: Lily Series, ...18.000000
4Beyond IBM: Leadership Marketing and Finance ...10.000000
............
241066Ã?Â?lpiraten.20.000000
241067Ã?Â?rger mit Produkt X. Roman.45.250000
241068Ã?Â?sterlich leben.17.000000
241069Ã?Â?stlich der Berge.32.666667
241070Ã?Â?thique en toc24.000000
\n", "

241071 rows × 3 columns

\n", "
" ], "text/plain": [ " Book-Title Book-Rating \\\n", "0 A Light in the Storm: The Civil War Diary of ... 4 \n", "1 Always Have Popsicles 1 \n", "2 Apple Magic (The Collector's series) 1 \n", "3 Ask Lily (Young Women of Faith: Lily Series, ... 1 \n", "4 Beyond IBM: Leadership Marketing and Finance ... 1 \n", "... ... ... \n", "241066 Ã?Â?lpiraten. 2 \n", "241067 Ã?Â?rger mit Produkt X. Roman. 4 \n", "241068 Ã?Â?sterlich leben. 1 \n", "241069 Ã?Â?stlich der Berge. 3 \n", "241070 Ã?Â?thique en toc 2 \n", "\n", " avg-Rating \n", "0 2.250000 \n", "1 0.000000 \n", "2 0.000000 \n", "3 8.000000 \n", "4 0.000000 \n", "... ... \n", "241066 0.000000 \n", "241067 5.250000 \n", "241068 7.000000 \n", "241069 2.666667 \n", "241070 4.000000 \n", "\n", "[241071 rows x 3 columns]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "populardf = ratingCount.merge(avg_ratingCount,on=\"Book-Title\")\n", "populardf" ] }, { "cell_type": "code", "execution_count": 15, "id": "X9GysGNJrzrC", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "X9GysGNJrzrC", "outputId": "5137d161-221f-4784-df58-9b8dda80298a" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Book-TitleBook-Ratingavg-RatingISBNBook-AuthorYear-Of-PublicationPublisherImage-URL-SImage-URL-MImage-URL-L
0Harry Potter and the Prisoner of Azkaban (Book 3)4285.8528040439136350J. K. Rowling1999Scholastichttp://images.amazon.com/images/P/0439136350.0...https://images.amazon.com/images/P/0439136350....http://images.amazon.com/images/P/0439136350.0...
1Harry Potter and the Prisoner of Azkaban (Book 3)4285.8528040439136369J. K. Rowling2001Scholastichttp://images.amazon.com/images/P/0439136369.0...https://images.amazon.com/images/P/0439136369....http://images.amazon.com/images/P/0439136369.0...
2Harry Potter and the Prisoner of Azkaban (Book 3)4285.8528040786222743J. K. Rowling2000Thorndike Presshttp://images.amazon.com/images/P/0786222743.0...https://images.amazon.com/images/P/0786222743....http://images.amazon.com/images/P/0786222743.0...
3Harry Potter and the Goblet of Fire (Book 4)3875.8242890439139597J. K. Rowling2000Scholastichttp://images.amazon.com/images/P/0439139597.0...https://images.amazon.com/images/P/0439139597....http://images.amazon.com/images/P/0439139597.0...
4Harry Potter and the Goblet of Fire (Book 4)3875.8242890439139600J. K. Rowling2002Scholastic Paperbackshttp://images.amazon.com/images/P/0439139600.0...https://images.amazon.com/images/P/0439139600....http://images.amazon.com/images/P/0439139600.0...
.................................
191Lord of the Flies2593.8185330698102193William G. Golding1978Putnam Pub Grouphttp://images.amazon.com/images/P/0698102193.0...https://images.amazon.com/images/P/0698102193....http://images.amazon.com/images/P/0698102193.0...
192A Prayer for Owen Meany4133.7966100345361792John Irving1990Ballantine Bookshttp://images.amazon.com/images/P/0345361792.0...https://images.amazon.com/images/P/0345361792....http://images.amazon.com/images/P/0345361792.0...
193A Prayer for Owen Meany4133.7966100345363523John Irving1989Ballantine Bookshttp://images.amazon.com/images/P/0345363523.0...https://images.amazon.com/images/P/0345363523....http://images.amazon.com/images/P/0345363523.0...
194The Vampire Lestat (Vampire Chronicles, Book II)3013.7774090345313860ANNE RICE1986Ballantine Bookshttp://images.amazon.com/images/P/0345313860.0...https://images.amazon.com/images/P/0345313860....http://images.amazon.com/images/P/0345313860.0...
195White Oleander : A Novel (Oprah's Book Club)3563.7724720316284955Janet Fitch2000Back Bay Bookshttp://images.amazon.com/images/P/0316284955.0...https://images.amazon.com/images/P/0316284955....http://images.amazon.com/images/P/0316284955.0...
\n", "

196 rows × 10 columns

\n", "
" ], "text/plain": [ " Book-Title Book-Rating \\\n", "0 Harry Potter and the Prisoner of Azkaban (Book 3) 428 \n", "1 Harry Potter and the Prisoner of Azkaban (Book 3) 428 \n", "2 Harry Potter and the Prisoner of Azkaban (Book 3) 428 \n", "3 Harry Potter and the Goblet of Fire (Book 4) 387 \n", "4 Harry Potter and the Goblet of Fire (Book 4) 387 \n", ".. ... ... \n", "191 Lord of the Flies 259 \n", "192 A Prayer for Owen Meany 413 \n", "193 A Prayer for Owen Meany 413 \n", "194 The Vampire Lestat (Vampire Chronicles, Book II) 301 \n", "195 White Oleander : A Novel (Oprah's Book Club) 356 \n", "\n", " avg-Rating ISBN Book-Author Year-Of-Publication \\\n", "0 5.852804 0439136350 J. K. Rowling 1999 \n", "1 5.852804 0439136369 J. K. Rowling 2001 \n", "2 5.852804 0786222743 J. K. Rowling 2000 \n", "3 5.824289 0439139597 J. K. Rowling 2000 \n", "4 5.824289 0439139600 J. K. Rowling 2002 \n", ".. ... ... ... ... \n", "191 3.818533 0698102193 William G. Golding 1978 \n", "192 3.796610 0345361792 John Irving 1990 \n", "193 3.796610 0345363523 John Irving 1989 \n", "194 3.777409 0345313860 ANNE RICE 1986 \n", "195 3.772472 0316284955 Janet Fitch 2000 \n", "\n", " Publisher Image-URL-S \\\n", "0 Scholastic http://images.amazon.com/images/P/0439136350.0... \n", "1 Scholastic http://images.amazon.com/images/P/0439136369.0... \n", "2 Thorndike Press http://images.amazon.com/images/P/0786222743.0... \n", "3 Scholastic http://images.amazon.com/images/P/0439139597.0... \n", "4 Scholastic Paperbacks http://images.amazon.com/images/P/0439139600.0... \n", ".. ... ... \n", "191 Putnam Pub Group http://images.amazon.com/images/P/0698102193.0... \n", "192 Ballantine Books http://images.amazon.com/images/P/0345361792.0... \n", "193 Ballantine Books http://images.amazon.com/images/P/0345363523.0... \n", "194 Ballantine Books http://images.amazon.com/images/P/0345313860.0... \n", "195 Back Bay Books http://images.amazon.com/images/P/0316284955.0... \n", "\n", " Image-URL-M \\\n", "0 https://images.amazon.com/images/P/0439136350.... \n", "1 https://images.amazon.com/images/P/0439136369.... \n", "2 https://images.amazon.com/images/P/0786222743.... \n", "3 https://images.amazon.com/images/P/0439139597.... \n", "4 https://images.amazon.com/images/P/0439139600.... \n", ".. ... \n", "191 https://images.amazon.com/images/P/0698102193.... \n", "192 https://images.amazon.com/images/P/0345361792.... \n", "193 https://images.amazon.com/images/P/0345363523.... \n", "194 https://images.amazon.com/images/P/0345313860.... \n", "195 https://images.amazon.com/images/P/0316284955.... \n", "\n", " Image-URL-L \n", "0 http://images.amazon.com/images/P/0439136350.0... \n", "1 http://images.amazon.com/images/P/0439136369.0... \n", "2 http://images.amazon.com/images/P/0786222743.0... \n", "3 http://images.amazon.com/images/P/0439139597.0... \n", "4 http://images.amazon.com/images/P/0439139600.0... \n", ".. ... \n", "191 http://images.amazon.com/images/P/0698102193.0... \n", "192 http://images.amazon.com/images/P/0345361792.0... \n", "193 http://images.amazon.com/images/P/0345363523.0... \n", "194 http://images.amazon.com/images/P/0345313860.0... \n", "195 http://images.amazon.com/images/P/0316284955.0... \n", "\n", "[196 rows x 10 columns]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Main_populardf = populardf[populardf['Book-Rating']>= 250].sort_values(by=\"avg-Rating\",ascending=False).head(50)\n", "Main_populardf.merge(book,on=\"Book-Title\")\n" ] }, { "cell_type": "code", "execution_count": 16, "id": "ttuzuVOdz9RQ", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "ttuzuVOdz9RQ", "outputId": "ebc64e9b-608b-45fe-9ca8-b2db0d899277" }, "outputs": [ { "data": { "text/plain": [ "'https://images.amazon.com/images/P/0439136350.01.MZZZZZZZ.jpg'" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "finalpopularity = Main_populardf.merge(book,on=\"Book-Title\").drop_duplicates(\"Book-Title\")[[\"Book-Title\",\"Book-Rating\",\"avg-Rating\",\"Image-URL-M\",\"Book-Author\",\"Year-Of-Publication\",\"ISBN\"]]\n", "finalpopularity = finalpopularity.drop(index=[89,157,117])\n", "finalpopularity[\"Image-URL-M\"][0]" ] }, { "cell_type": "markdown", "id": "t8mmRZNTB4N7", "metadata": { "id": "t8mmRZNTB4N7" }, "source": [ "# Collabrative filtering based Recommendation system" ] }, { "cell_type": "code", "execution_count": 17, "id": "nDjU35B6B6hD", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "nDjU35B6B6hD", "outputId": "8391d1a1-085e-4de3-a3ee-0c075f576046" }, "outputs": [ { "data": { "text/plain": [ "Index([ 254, 1733, 1903, 2033, 2110, 2276, 2766, 2891, 2977,\n", " 3363,\n", " ...\n", " 274301, 274308, 274808, 275970, 276680, 277427, 277478, 277639, 278188,\n", " 278418],\n", " dtype='int64', name='User-ID', length=1115)" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = merge_bookRating.groupby(\"User-ID\").count()[\"Book-Rating\"] >150\n", "ExperianceUser = x[x].index\n", "ExperianceUser" ] }, { "cell_type": "code", "execution_count": 18, "id": "At4t8_FaB6rZ", "metadata": { "id": "At4t8_FaB6rZ" }, "outputs": [], "source": [ "# now extracting info of these ExperianceUser form main df\n", "FilteredDataFrame = merge_bookRating[merge_bookRating[\"User-ID\"].isin(ExperianceUser)]" ] }, { "cell_type": "code", "execution_count": 19, "id": "mKSpGjIrFjEn", "metadata": { "id": "mKSpGjIrFjEn" }, "outputs": [], "source": [ "y = FilteredDataFrame.groupby(\"Book-Title\").count()[\"Book-Rating\"] > 50\n", "FamousBook = y[y].index" ] }, { "cell_type": "code", "execution_count": 20, "id": "dDXOIlNkG2To", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 615 }, "id": "dDXOIlNkG2To", "outputId": "f8a61857-996c-4e84-baaf-51eacaf698b6" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ISBNBook-TitleBook-AuthorYear-Of-PublicationPublisherImage-URL-MUser-IDBook-Rating
300399135782The Kitchen God's WifeAmy Tan1991Putnam Pub Grouphttps://images.amazon.com/images/P/0399135782....80
310399135782The Kitchen God's WifeAmy Tan1991Putnam Pub Grouphttps://images.amazon.com/images/P/0399135782....116769
320399135782The Kitchen God's WifeAmy Tan1991Putnam Pub Grouphttps://images.amazon.com/images/P/0399135782....295269
330399135782The Kitchen God's WifeAmy Tan1991Putnam Pub Grouphttps://images.amazon.com/images/P/0399135782....368360
340399135782The Kitchen God's WifeAmy Tan1991Putnam Pub Grouphttps://images.amazon.com/images/P/0399135782....463989
...........................
102921205820601841984George Orwell1991Longman Publishing Grouphttps://images.amazon.com/images/P/0582060184....2412020
10297820805041494Still WatersJohn Harvey1997Henry Holt & Companyhttps://images.amazon.com/images/P/0805041494....2425008
10302041853716154Lucy Sullivan Is Getting MarriedMarian Keyes1996Poolbeg Pr Ltdhttps://images.amazon.com/images/P/1853716154....2433682
10304940553290703LightningPatricia Potter1992Bantam Bookshttps://images.amazon.com/images/P/0553290703....2446859
10309820395647398The Two Towers (The Lord of the Rings, Part 2)J. R. R. Tolkien1992Houghton Mifflinhttps://images.amazon.com/images/P/0395647398....25990110
\n", "

173224 rows × 8 columns

\n", "
" ], "text/plain": [ " ISBN Book-Title \\\n", "30 0399135782 The Kitchen God's Wife \n", "31 0399135782 The Kitchen God's Wife \n", "32 0399135782 The Kitchen God's Wife \n", "33 0399135782 The Kitchen God's Wife \n", "34 0399135782 The Kitchen God's Wife \n", "... ... ... \n", "1029212 0582060184 1984 \n", "1029782 0805041494 Still Waters \n", "1030204 1853716154 Lucy Sullivan Is Getting Married \n", "1030494 0553290703 Lightning \n", "1030982 0395647398 The Two Towers (The Lord of the Rings, Part 2) \n", "\n", " Book-Author Year-Of-Publication Publisher \\\n", "30 Amy Tan 1991 Putnam Pub Group \n", "31 Amy Tan 1991 Putnam Pub Group \n", "32 Amy Tan 1991 Putnam Pub Group \n", "33 Amy Tan 1991 Putnam Pub Group \n", "34 Amy Tan 1991 Putnam Pub Group \n", "... ... ... ... \n", "1029212 George Orwell 1991 Longman Publishing Group \n", "1029782 John Harvey 1997 Henry Holt & Company \n", "1030204 Marian Keyes 1996 Poolbeg Pr Ltd \n", "1030494 Patricia Potter 1992 Bantam Books \n", "1030982 J. R. R. Tolkien 1992 Houghton Mifflin \n", "\n", " Image-URL-M User-ID \\\n", "30 https://images.amazon.com/images/P/0399135782.... 8 \n", "31 https://images.amazon.com/images/P/0399135782.... 11676 \n", "32 https://images.amazon.com/images/P/0399135782.... 29526 \n", "33 https://images.amazon.com/images/P/0399135782.... 36836 \n", "34 https://images.amazon.com/images/P/0399135782.... 46398 \n", "... ... ... \n", "1029212 https://images.amazon.com/images/P/0582060184.... 241202 \n", "1029782 https://images.amazon.com/images/P/0805041494.... 242500 \n", "1030204 https://images.amazon.com/images/P/1853716154.... 243368 \n", "1030494 https://images.amazon.com/images/P/0553290703.... 244685 \n", "1030982 https://images.amazon.com/images/P/0395647398.... 259901 \n", "\n", " Book-Rating \n", "30 0 \n", "31 9 \n", "32 9 \n", "33 0 \n", "34 9 \n", "... ... \n", "1029212 0 \n", "1029782 8 \n", "1030204 2 \n", "1030494 9 \n", "1030982 10 \n", "\n", "[173224 rows x 8 columns]" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "FilteredDataFrame = merge_bookRating[merge_bookRating[\"Book-Title\"].isin(FamousBook)]\n", "FilteredDataFrame = FilteredDataFrame.drop(columns=[\"Image-URL-S\",\"Image-URL-L\"])\n", "FilteredDataFrame" ] }, { "cell_type": "code", "execution_count": 21, "id": "Z9mqzhWuH9-g", "metadata": { "id": "Z9mqzhWuH9-g" }, "outputs": [], "source": [ "finaldf = FilteredDataFrame.pivot_table(index = \"Book-Title\",columns=\"User-ID\",values=\"Book-Rating\")\n", "finaldf = finaldf.fillna(0)\n" ] }, { "cell_type": "code", "execution_count": 22, "id": "7P2vJ_9FJOja", "metadata": { "id": "7P2vJ_9FJOja" }, "outputs": [], "source": [ "from sklearn.metrics.pairwise import cosine_similarity" ] }, { "cell_type": "code", "execution_count": 23, "id": "f6fhCqa8Mqra", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "f6fhCqa8Mqra", "outputId": "9c44bab8-28d8-4de8-fd1f-dbc390526ccb" }, "outputs": [ { "data": { "text/plain": [ "(844, 844)" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "similarityScore = cosine_similarity(finaldf)\n", "similarityScore.shape" ] }, { "cell_type": "code", "execution_count": 24, "id": "6_K7pfAWM2al", "metadata": { "id": "6_K7pfAWM2al" }, "outputs": [], "source": [ "def recommend(BookName):\n", " index = np.where(finaldf.index == BookName)[0][0]\n", " similarBook = sorted(list(enumerate(similarityScore[index])),key = lambda x:x[1],reverse=True)[1:6]\n", "\n", " data = []\n", " for i in similarBook:\n", " item = []\n", " # print(finaldf.index[i[0]])\n", " tempdf = book[book[\"Book-Title\"] == finaldf.index[i[0]]]\n", " item.extend(list(tempdf.drop_duplicates(\"Book-Title\")[\"Book-Title\"].values))\n", " item.extend(list(tempdf.drop_duplicates(\"Book-Title\")[\"Image-URL-M\"].values))\n", " item.extend(list(tempdf.drop_duplicates(\"Book-Title\")[\"Book-Author\"].values))\n", " \n", " data.append(item)\n", " return data\n", " \n" ] }, { "cell_type": "code", "execution_count": 25, "id": "xDN4eMAOO8s0", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "xDN4eMAOO8s0", "outputId": "1cd38d97-18b1-4fd7-c9be-23b9a00411e1" }, "outputs": [ { "data": { "text/plain": [ "[['Animal Farm',\n", " 'https://images.amazon.com/images/P/0451526341.01.MZZZZZZZ.jpg',\n", " 'George Orwell'],\n", " ['Brave New World',\n", " 'https://images.amazon.com/images/P/0060809833.01.MZZZZZZZ.jpg',\n", " 'Aldous Huxley'],\n", " [\"Slaughterhouse Five or the Children's Crusade: A Duty Dance With Death\",\n", " 'https://images.amazon.com/images/P/0440180295.01.MZZZZZZZ.jpg',\n", " 'Kurt Vonnegut'],\n", " ['Lord of the Flies',\n", " 'https://images.amazon.com/images/P/0399501487.01.MZZZZZZZ.jpg',\n", " 'William Gerald Golding'],\n", " ['The Vampire Lestat (Vampire Chronicles, Book II)',\n", " 'https://images.amazon.com/images/P/0345313860.01.MZZZZZZZ.jpg',\n", " 'ANNE RICE']]" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "recommend(\"1984\")" ] }, { "cell_type": "code", "execution_count": 26, "id": "k7y5tnocPAg9", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "k7y5tnocPAg9", "outputId": "7877831e-2b34-4130-957b-52bdcd618a8b" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
User-ID891416172632394244...278819278820278824278828278832278836278843278844278846278854
Book-Title
19840.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
1st to Die: A Novel0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
2nd Chance0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
4 Blondes0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
84 Charing Cross Road0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Beautiful Mind: The Life of Mathematical Genius and Nobel Laureate John Nash0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Bend in the Road0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Case of Need0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Child Called \\It\\\": One Child's Courage to Survive\"0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Civil Action0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Cry In The Night0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Darkness More Than Night0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Day Late and a Dollar Short0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Fine Balance0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Great Deliverance0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Heartbreaking Work of Staggering Genius0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Is for Alibi (Kinsey Millhone Mysteries (Paperback))0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Lesson Before Dying (Vintage Contemporaries (Paperback))0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Light in the Window (The Mitford Years)0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Man Named Dave: A Story of Triumph and Forgiveness0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Man in Full0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Map of the World0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Painted House0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Patchwork Planet0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Prayer for Owen Meany0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Thin Dark Line (Mysteries & Horror)0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Thousand Acres (Ballantine Reader's Circle)0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Time to Kill0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Virtuous Woman (Oprah's Book Club (Paperback))0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.07.0
A Walk in the Woods: Rediscovering America on the Appalachian Trail (Official Guides to the Appalachian Trail)0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Walk to Remember0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Widow for One Year0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Wrinkle In Time0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Wrinkle in Time0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
A Year in Provence0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
ANGELA'S ASHES0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Abduction0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
About a Boy0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Absolute Power0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Acceptable Risk0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Accident0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
After All These Years0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
After Dark0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Airframe0.00.00.09.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
Alaska0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
All Around the Town0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
All Creatures Great and Small0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
All I Really Need to Know0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
All That Remains (Kay Scarpetta Mysteries (Paperback))0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
All the Pretty Horses (The Border Trilogy, Vol 1)0.00.00.00.00.00.00.00.00.00.0...0.00.00.00.00.00.00.00.00.00.0
\n", "

50 rows × 35830 columns

\n", "
" ], "text/plain": [ "User-ID 8 9 14 \\\n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 0.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "User-ID 16 17 26 \\\n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 9.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "User-ID 32 39 42 \\\n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 0.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "User-ID 44 ... 278819 \\\n", "Book-Title ... \n", "1984 0.0 ... 0.0 \n", "1st to Die: A Novel 0.0 ... 0.0 \n", "2nd Chance 0.0 ... 0.0 \n", "4 Blondes 0.0 ... 0.0 \n", "84 Charing Cross Road 0.0 ... 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 ... 0.0 \n", "A Bend in the Road 0.0 ... 0.0 \n", "A Case of Need 0.0 ... 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 ... 0.0 \n", "A Civil Action 0.0 ... 0.0 \n", "A Cry In The Night 0.0 ... 0.0 \n", "A Darkness More Than Night 0.0 ... 0.0 \n", "A Day Late and a Dollar Short 0.0 ... 0.0 \n", "A Fine Balance 0.0 ... 0.0 \n", "A Great Deliverance 0.0 ... 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 ... 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 ... 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 ... 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 ... 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 ... 0.0 \n", "A Man in Full 0.0 ... 0.0 \n", "A Map of the World 0.0 ... 0.0 \n", "A Painted House 0.0 ... 0.0 \n", "A Patchwork Planet 0.0 ... 0.0 \n", "A Prayer for Owen Meany 0.0 ... 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 ... 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 ... 0.0 \n", "A Time to Kill 0.0 ... 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 ... 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 ... 0.0 \n", "A Walk to Remember 0.0 ... 0.0 \n", "A Widow for One Year 0.0 ... 0.0 \n", "A Wrinkle In Time 0.0 ... 0.0 \n", "A Wrinkle in Time 0.0 ... 0.0 \n", "A Year in Provence 0.0 ... 0.0 \n", "ANGELA'S ASHES 0.0 ... 0.0 \n", "Abduction 0.0 ... 0.0 \n", "About a Boy 0.0 ... 0.0 \n", "Absolute Power 0.0 ... 0.0 \n", "Acceptable Risk 0.0 ... 0.0 \n", "Accident 0.0 ... 0.0 \n", "After All These Years 0.0 ... 0.0 \n", "After Dark 0.0 ... 0.0 \n", "Airframe 0.0 ... 0.0 \n", "Alaska 0.0 ... 0.0 \n", "All Around the Town 0.0 ... 0.0 \n", "All Creatures Great and Small 0.0 ... 0.0 \n", "All I Really Need to Know 0.0 ... 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 ... 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 ... 0.0 \n", "\n", "User-ID 278820 278824 278828 \\\n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 0.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "User-ID 278832 278836 278843 \\\n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 0.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 0.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "User-ID 278844 278846 278854 \n", "Book-Title \n", "1984 0.0 0.0 0.0 \n", "1st to Die: A Novel 0.0 0.0 0.0 \n", "2nd Chance 0.0 0.0 0.0 \n", "4 Blondes 0.0 0.0 0.0 \n", "84 Charing Cross Road 0.0 0.0 0.0 \n", "A Beautiful Mind: The Life of Mathematical Geni... 0.0 0.0 0.0 \n", "A Bend in the Road 0.0 0.0 0.0 \n", "A Case of Need 0.0 0.0 0.0 \n", "A Child Called \\It\\\": One Child's Courage to Su... 0.0 0.0 0.0 \n", "A Civil Action 0.0 0.0 0.0 \n", "A Cry In The Night 0.0 0.0 0.0 \n", "A Darkness More Than Night 0.0 0.0 0.0 \n", "A Day Late and a Dollar Short 0.0 0.0 0.0 \n", "A Fine Balance 0.0 0.0 0.0 \n", "A Great Deliverance 0.0 0.0 0.0 \n", "A Heartbreaking Work of Staggering Genius 0.0 0.0 0.0 \n", "A Is for Alibi (Kinsey Millhone Mysteries (Pape... 0.0 0.0 0.0 \n", "A Lesson Before Dying (Vintage Contemporaries (... 0.0 0.0 0.0 \n", "A Light in the Window (The Mitford Years) 0.0 0.0 0.0 \n", "A Man Named Dave: A Story of Triumph and Forgiv... 0.0 0.0 0.0 \n", "A Man in Full 0.0 0.0 0.0 \n", "A Map of the World 0.0 0.0 0.0 \n", "A Painted House 0.0 0.0 0.0 \n", "A Patchwork Planet 0.0 0.0 0.0 \n", "A Prayer for Owen Meany 0.0 0.0 0.0 \n", "A Thin Dark Line (Mysteries & Horror) 0.0 0.0 0.0 \n", "A Thousand Acres (Ballantine Reader's Circle) 0.0 0.0 0.0 \n", "A Time to Kill 0.0 0.0 0.0 \n", "A Virtuous Woman (Oprah's Book Club (Paperback)) 0.0 0.0 7.0 \n", "A Walk in the Woods: Rediscovering America on t... 0.0 0.0 0.0 \n", "A Walk to Remember 0.0 0.0 0.0 \n", "A Widow for One Year 0.0 0.0 0.0 \n", "A Wrinkle In Time 0.0 0.0 0.0 \n", "A Wrinkle in Time 0.0 0.0 0.0 \n", "A Year in Provence 0.0 0.0 0.0 \n", "ANGELA'S ASHES 0.0 0.0 0.0 \n", "Abduction 0.0 0.0 0.0 \n", "About a Boy 0.0 0.0 0.0 \n", "Absolute Power 0.0 0.0 0.0 \n", "Acceptable Risk 0.0 0.0 0.0 \n", "Accident 0.0 0.0 0.0 \n", "After All These Years 0.0 0.0 0.0 \n", "After Dark 0.0 0.0 0.0 \n", "Airframe 0.0 0.0 0.0 \n", "Alaska 0.0 0.0 0.0 \n", "All Around the Town 0.0 0.0 0.0 \n", "All Creatures Great and Small 0.0 0.0 0.0 \n", "All I Really Need to Know 0.0 0.0 0.0 \n", "All That Remains (Kay Scarpetta Mysteries (Pape... 0.0 0.0 0.0 \n", "All the Pretty Horses (The Border Trilogy, Vol 1) 0.0 0.0 0.0 \n", "\n", "[50 rows x 35830 columns]" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "finaldf.head(50)" ] }, { "cell_type": "code", "execution_count": 27, "id": "cVuhw2epYGa7", "metadata": { "id": "cVuhw2epYGa7" }, "outputs": [], "source": [ "import pickle\n", "pickle.dump(finalpopularity,open(\"finalpopularity.pkl\",\"wb\"))\n", "# pickle.dump(book,open(\"book.pkl\",\"wb\"))\n", "# pickle.dump(similarityScore,open(\"similarityScore.pkl\",\"wb\"))\n", "# pickle.dump(finaldf,open(\"finaldf.pkl\",\"wb\"))" ] }, { "cell_type": "code", "execution_count": null, "id": "22b25277", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "accelerator": "GPU", "colab": { "gpuType": "T4", "provenance": [] }, "kernelspec": { "display_name": "env", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 5 }