-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
2 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[{"file_id":"1ibYR9SiNhBsiwQ1UEpaFCu5t7B5E9c2u","timestamp":1719635079469}],"authorship_tag":"ABX9TyNH6Oztif2nDu1RBNxBtPL1"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"source":["import pandas as pd\n","\n","# Load the dataset\n","books_df = pd.read_csv('/content/books.csv')\n","\n","def search_books(keyword):\n"," \"\"\"\n"," Search for books that match the keyword in the title, authors, or publisher.\n"," \"\"\"\n"," keyword = keyword.lower()\n"," results = books_df[\n"," books_df['title'].str.lower().str.contains(keyword) |\n"," books_df['authors'].str.lower().str.contains(keyword) |\n"," books_df['publisher'].str.lower().str.contains(keyword)\n"," ]\n"," return results\n","\n","\n","def display_books(books):\n"," \"\"\"\n"," Display the list of books.\n"," \"\"\"\n"," if books.empty:\n"," print(\"No books found.\")\n"," else:\n"," for index, book in books.iterrows():\n"," print(f\"Title: {book['title']}\")\n"," print(f\"Author: {book['authors']}\")\n"," print(f\"Average Rating: {book['average_rating']}\")\n"," print(f\"ISBN: {book['isbn']}\")\n"," print(f\"ISBN13: {book['isbn13']}\")\n"," print(f\"Language: {book['language_code']}\")\n"," # Check if 'num_pages' column exists before printing\n"," if 'num_pages' in book:\n"," print(f\"Number of Pages: {book['num_pages']}\")\n"," print(f\"Ratings Count: {book['ratings_count']}\")\n"," print(f\"Text Reviews Count: {book['text_reviews_count']}\")\n"," print(f\"Publication Date: {book['publication_date']}\")\n"," print(f\"Publisher: {book['publisher']}\")\n"," print('-' * 40)\n","\n","def main():\n"," print(\"Welcome to the Book Recommendation Program!\")\n"," keyword = input(\"Enter a keyword to search for books: \")\n"," results = search_books(keyword)\n"," display_books(results)\n","\n","if __name__ == \"__main__\":\n"," main()\n"],"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"bn90ajE4I-5i","executionInfo":{"status":"ok","timestamp":1719599950418,"user_tz":-330,"elapsed":18807,"user":{"displayName":"Ruchi Jha","userId":"17183609542544808004"}},"outputId":"2f0c3c47-631f-4986-c929-85587ade2d2e"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Welcome to the Book Recommendation Program!\n","Enter a keyword to search for books: Mark Twain\n","Title: The Innocents Abroad\n","Author: Mark Twain/Grover Gardner\n","Average Rating: 3.86\n","ISBN: 812967054\n","ISBN13: 9.78081E+12\n","Language: eng\n","Ratings Count: 8879\n","Text Reviews Count: 693\n","Publication Date: 02-11-2003\n","Publisher: Modern Library\n","----------------------------------------\n","Title: The Tragedy of Pudd'nhead Wilson/Those Extraordinary Twins\n","Author: Mark Twain/David Lionel Smith/Sherley Anne Williams\n","Average Rating: 3.79\n","ISBN: 195114159\n","ISBN13: 9.7802E+12\n","Language: eng\n","Ratings Count: 3664\n","Text Reviews Count: 58\n","Publication Date: 03-06-1997\n","Publisher: Oxford University Press USA\n","----------------------------------------\n","Title: The Tragedy of Pudd'nhead Wilson\n","Author: Mark Twain/Michael Prichard\n","Average Rating: 3.79\n","ISBN: 140015068X\n","ISBN13: 9.7814E+12\n","Language: eng\n","Ratings Count: 3\n","Text Reviews Count: 0\n","Publication Date: 01-01-2003\n","Publisher: Tantor Media\n","----------------------------------------\n","Title: Huck Finn & Tom Sawyer among the Indians & Other Unfinished Stories (Mark Twain Library)\n","Author: Mark Twain/Paul Baender/Dahlia Armon/Walter Blair\n","Average Rating: 3.85\n","ISBN: 520238958\n","ISBN13: 9.78052E+12\n","Language: eng\n","Ratings Count: 5\n","Text Reviews Count: 0\n","Publication Date: 3/15/2003\n","Publisher: University of California Press\n","----------------------------------------\n","Title: Huck Finn and Tom Sawyer Among the Indians\n","Author: Mark Twain/Lee Nelson\n","Average Rating: 3.57\n","ISBN: 1555176801\n","ISBN13: 9.78156E+12\n","Language: eng\n","Ratings Count: 242\n","Text Reviews Count: 29\n","Publication Date: 4/22/2003\n","Publisher: Council Press\n","----------------------------------------\n","Title: Huck Finn/Pudd'nhead Wilson/No 44 Mysterious Stranger other Writings\n","Author: Mark Twain/Guy Cardwell/Louis J. Budd\n","Average Rating: 4.06\n","ISBN: 1883011884\n","ISBN13: 9.78188E+12\n","Language: en-US\n","Ratings Count: 33\n","Text Reviews Count: 3\n","Publication Date: 08-01-2000\n","Publisher: Library of America\n","----------------------------------------\n","Title: The Adventures of Huckleberry Finn (Adventures of Tom and Huck #2)\n","Author: Mark Twain/Guy Cardwell/John Seelye/Walter Trier\n","Average Rating: 3.82\n","ISBN: 142437174\n","ISBN13: 9.78014E+12\n","Language: eng\n","Ratings Count: 1049912\n","Text Reviews Count: 11391\n","Publication Date: 12/31/2002\n","Publisher: Penguin Classics\n","----------------------------------------\n","Title: Adventures of Huckleberry Finn\n","Author: Mark Twain/E.W. Kemble\n","Average Rating: 3.82\n","ISBN: 486443221\n","ISBN13: 9.78049E+12\n","Language: eng\n","Ratings Count: 144\n","Text Reviews Count: 17\n","Publication Date: 05-06-2005\n","Publisher: Dover Publications\n","----------------------------------------\n","Title: Adventures of Huckleberry Finn\n","Author: Mark Twain/George Saunders\n","Average Rating: 3.82\n","ISBN: 375757376\n","ISBN13: 9.78038E+12\n","Language: eng\n","Ratings Count: 687\n","Text Reviews Count: 37\n","Publication Date: 8/14/2001\n","Publisher: The Modern Library\n","----------------------------------------\n","Title: The Annotated Huckleberry Finn\n","Author: Mark Twain/Michael Patrick Hearn/E.W. Kemble\n","Average Rating: 3.82\n","ISBN: 393020398\n","ISBN13: 9.78039E+12\n","Language: eng\n","Ratings Count: 185\n","Text Reviews Count: 18\n","Publication Date: 10/17/2001\n","Publisher: W. W. Norton Company\n","----------------------------------------\n","Title: The Wit and Wisdom of Mark Twain\n","Author: Mark Twain\n","Average Rating: 4.2\n","ISBN: 486406644\n","ISBN13: 9.78049E+12\n","Language: eng\n","Ratings Count: 970\n","Text Reviews Count: 53\n","Publication Date: 12/23/1998\n","Publisher: Dover Publications\n","----------------------------------------\n","Title: Mark Twain's Helpful Hints for Good Living: A Handbook for the Damned Human Race\n","Author: Mark Twain/Lin Salamo/Victor Fischer/Michael B. Frank\n","Average Rating: 3.86\n","ISBN: 520242459\n","ISBN13: 9.78052E+12\n","Language: eng\n","Ratings Count: 513\n","Text Reviews Count: 71\n","Publication Date: 10/18/2004\n","Publisher: University of California Press\n","----------------------------------------\n","Title: The Complete Short Stories of Mark Twain\n","Author: Mark Twain/Charles Neider\n","Average Rating: 4.28\n","ISBN: 553211951\n","ISBN13: 9.78055E+12\n","Language: eng\n","Ratings Count: 5710\n","Text Reviews Count: 142\n","Publication Date: 03-01-1984\n","Publisher: Bantam Classics\n","----------------------------------------\n","Title: The Autobiography of Mark Twain\n","Author: Mark Twain/Charles Neider\n","Average Rating: 4.05\n","ISBN: 60955422\n","ISBN13: 9.78006E+12\n","Language: eng\n","Ratings Count: 2871\n","Text Reviews Count: 209\n","Publication Date: 11/28/2000\n","Publisher: Harper Perennial\n","----------------------------------------\n","Title: Collected Tales Sketches Speeches & Essays 1891–1910\n","Author: Mark Twain/Louis J. Budd\n","Average Rating: 4.39\n","ISBN: 940450739\n","ISBN13: 9.78094E+12\n","Language: eng\n","Ratings Count: 207\n","Text Reviews Count: 10\n","Publication Date: 10/15/1992\n","Publisher: Library of America\n","----------------------------------------\n","Title: The Adventures of Huckleberry Finn\n","Author: Mark Twain/Scott McKowen/Arthur Pober\n","Average Rating: 3.82\n","ISBN: 1402726007\n","ISBN13: 9.7814E+12\n","Language: eng\n","Ratings Count: 364\n","Text Reviews Count: 27\n","Publication Date: 10/28/2006\n","Publisher: Sterling\n","----------------------------------------\n","Title: The Adventures of Huckleberry Finn\n","Author: Mark Twain/Peter Coveney\n","Average Rating: 3.82\n","ISBN: 141439645\n","ISBN13: 9.78014E+12\n","Language: eng\n","Ratings Count: 1980\n","Text Reviews Count: 66\n","Publication Date: 1/30/2003\n","Publisher: Penguin Books\n","----------------------------------------\n","Title: Mark Twain's Adventures of Huckleberry Finn\n","Author: Mark Twain/Richard P. Wasowski\n","Average Rating: 3.82\n","ISBN: 764587277\n","ISBN13: 9.78076E+12\n","Language: eng\n","Ratings Count: 12\n","Text Reviews Count: 0\n","Publication Date: 05-01-2001\n","Publisher: Hungry Minds\n","----------------------------------------\n","Title: Collected Tales Sketches Speeches & Essays 1852–1890\n","Author: Mark Twain/Louis J. Budd\n","Average Rating: 4.29\n","ISBN: 940450364\n","ISBN13: 9.78094E+12\n","Language: eng\n","Ratings Count: 67\n","Text Reviews Count: 6\n","Publication Date: 10/15/1992\n","Publisher: Library of America\n","----------------------------------------\n","Title: Mark Twain's Own Autobiography: The Chapters from the North American Review\n","Author: Mark Twain/Michael J. Kiskis\n","Average Rating: 3.8\n","ISBN: 299125408\n","ISBN13: 9.7803E+12\n","Language: eng\n","Ratings Count: 9\n","Text Reviews Count: 1\n","Publication Date: 10-01-1990\n","Publisher: University of Wisconsin Press\n","----------------------------------------\n","Title: The Adventures of Tom Sawyer and Adventures of Huckleberry Finn\n","Author: Mark Twain/Shelly Fisher Fishkin\n","Average Rating: 4.08\n","ISBN: 451528646\n","ISBN13: 9.78045E+12\n","Language: eng\n","Ratings Count: 33489\n","Text Reviews Count: 453\n","Publication Date: 12-03-2002\n","Publisher: Signet Classics\n","----------------------------------------\n","Title: The Adventures of Tom Sawyer (Adventures of Tom and Huck #1)\n","Author: Mark Twain/Scott McKowen\n","Average Rating: 3.91\n","ISBN: 1402714602\n","ISBN13: 9.7814E+12\n","Language: eng\n","Ratings Count: 1507\n","Text Reviews Count: 105\n","Publication Date: 10-01-2004\n","Publisher: Sterling\n","----------------------------------------\n","Title: The Adventures of Tom Sawyer (Adventures of Tom and Huck #1)\n","Author: Mark Twain/Guy Cardwell/John Seelye\n","Average Rating: 3.91\n","ISBN: 143039563\n","ISBN13: 9.78014E+12\n","Language: eng\n","Ratings Count: 667590\n","Text Reviews Count: 6783\n","Publication Date: 2/28/2006\n","Publisher: Penguin Classics\n","----------------------------------------\n","Title: Historical Romances: The Prince and the Pauper / A Connecticut Yankee in King Arthur’s Court / Personal Recollections of Joan of Arc\n","Author: Mark Twain/Susan K. Harris\n","Average Rating: 4.38\n","ISBN: 940450828\n","ISBN13: 9.78094E+12\n","Language: eng\n","Ratings Count: 296\n","Text Reviews Count: 13\n","Publication Date: 08-01-1994\n","Publisher: Library of America\n","----------------------------------------\n","Title: Letters from the Earth: Uncensored Writings\n","Author: Mark Twain/Bernard DeVoto/Henry Nash Smith\n","Average Rating: 4.21\n","ISBN: 60518650\n","ISBN13: 9.78006E+12\n","Language: eng\n","Ratings Count: 6568\n","Text Reviews Count: 376\n","Publication Date: 2/17/2004\n","Publisher: Harper Perennial Modern Classics\n","----------------------------------------\n","Title: Mark Twain: Selected Works\n","Author: Mark Twain\n","Average Rating: 4.22\n","ISBN: 517053578\n","ISBN13: 9.78052E+12\n","Language: eng\n","Ratings Count: 41\n","Text Reviews Count: 1\n","Publication Date: 10-02-1990\n","Publisher: Gramercy\n","----------------------------------------\n","Title: Adventures of Huckleberry Finn\n","Author: Mark Twain\n","Average Rating: 3.82\n","ISBN: 440300282\n","ISBN13: 9.78044E+12\n","Language: eng\n","Ratings Count: 90\n","Text Reviews Count: 2\n","Publication Date: 11/15/1977\n","Publisher: Laurel\n","----------------------------------------\n","Title: Who Was Mark Twain?\n","Author: April Jones Prince/Nancy Harrison/John O'Brien\n","Average Rating: 4.16\n","ISBN: 448433192\n","ISBN13: 9.78045E+12\n","Language: eng\n","Ratings Count: 529\n","Text Reviews Count: 56\n","Publication Date: 5/24/2004\n","Publisher: Grosset & Dunlap\n","----------------------------------------\n","Title: Roughing It\n","Author: Mark Twain/Henry B. Wonham\n","Average Rating: 3.89\n","ISBN: 743436504\n","ISBN13: 9.78074E+12\n","Language: eng\n","Ratings Count: 5846\n","Text Reviews Count: 494\n","Publication Date: 4/29/2003\n","Publisher: Pocket Books\n","----------------------------------------\n","Title: The Complete Essays of Mark Twain\n","Author: Mark Twain/Charles Neider\n","Average Rating: 4.33\n","ISBN: 306809575\n","ISBN13: 9.78031E+12\n","Language: eng\n","Ratings Count: 195\n","Text Reviews Count: 15\n","Publication Date: 11-02-2000\n","Publisher: Da Capo Press\n","----------------------------------------\n","Title: A Tramp Abroad\n","Author: Mark Twain/Dave Eggers\n","Average Rating: 3.86\n","ISBN: 812970039\n","ISBN13: 9.78081E+12\n","Language: eng\n","Ratings Count: 26\n","Text Reviews Count: 9\n","Publication Date: 10/14/2003\n","Publisher: Modern Library\n","----------------------------------------\n","Title: Las aventuras de Tom Sawyer\n","Author: Mark Twain\n","Average Rating: 3.91\n","ISBN: 8497646983\n","ISBN13: 9.7885E+12\n","Language: spa\n","Ratings Count: 113\n","Text Reviews Count: 12\n","Publication Date: 5/28/2006\n","Publisher: Edimat Libros\n","----------------------------------------\n"]}]}]} |
Large diffs are not rendered by default.
Oops, something went wrong.