<jupyter_start><jupyter_text>Ratings<jupyter_code>r.head()<jupyter_output><empty_output><jupyter_text>Ratings are sorted chronologically, oldest first.<jupyter_code>len(r)
r.rating.hist( bins = 5 )<jupyter_output><empty_output><jupyter_text>It appears that 4 is the most popular rating. There are relatively few ones and twos.  To readThese are the books users marked "to read".<jupyter_code>tr.head()
len(tr)<jupyter_output><empty_output><jupyter_text>Most books have been marked to read by somebody. Majority of the users have some books marked to read.<jupyter_code>len(tr.book_id.unique())
len(tr.user_id.unique())<jupyter_output><empty_output><jupyter_text>Books<jupyter_code>b.head()<jupyter_output><empty_output><jupyter_text>Books are sorted by their popularity, as measured by number of ratings (overall, not in this dataset).<jupyter_code>len(b)<jupyter_output><empty_output><jupyter_text>User and book IDs<jupyter_code>r.user_id.max()
r.book_id.max()<jupyter_output><empty_output><jupyter_text>The IDs are contiguous.<jupyter_code>assert( len( r.user_id.unique()) == r.user_id.max())
assert( len( r.book_id.unique()) == r.book_id.max())<jupyter_output><empty_output><jupyter_text>Reviews per book Most books have a few hundred reviews, but some have as few as eight.<jupyter_code>reviews_per_book = r.groupby( 'book_id' ).book_id.apply( lambda x: len( x ))
reviews_per_book.describe()
reviews_per_book.sort_values().head( 10 )<jupyter_output><empty_output><jupyter_text>Reviews per user All users have at least 19 reviews.<jupyter_code>reviews_per_user = r.groupby( 'user_id' ).user_id.apply( lambda x: len( x ))
reviews_per_user.describe()
reviews_per_user.sort_values().head( 10 )<jupyter_output><empty_output><jupyter_text>Tags<jupyter_code>t.head()
len(t)
bt.head()<jupyter_output><empty_output><jupyter_text>Tag applications are sorted by goodreads_book_id ASC and by count DESC.<jupyter_code>len(bt)<jupyter_output><empty_output><jupyter_text>Let us merge tag names into tag applications.<jupyter_code>bt = bt.merge( t, on = 'tag_id' )<jupyter_output><empty_output><jupyter_text>Why don't we merge book titles for good measure.<jupyter_code>bt = bt.merge( b[[ 'goodreads_book_id', 'title']], on = 'goodreads_book_id' )<jupyter_output><empty_output><jupyter_text>It appears that there are some negative tag counts. Let's fix this.<jupyter_code>bt['count'].describe()
bt.loc[ bt['count'] < 0, 'count'] = 0<jupyter_output><empty_output><jupyter_text>Sample some popular book tags.<jupyter_code>bt.sample( 10, weights = 'count')<jupyter_output><empty_output><jupyter_text>These are the most popular tags:<jupyter_code>tag_counts = bt.groupby( 'tag_name' ).tag_name.count().sort_values( ascending = False )
tag_counts.head( 20 )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12815884476534295, 'fraction_numerical': 0.005054151624548736, 'mean_word_length': 8.72280701754386, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '46023', 'license': 'MIT', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1020, 'n_words': 206, 'path': 'goodbooks-10k/quick_look.ipynb', 'repo_name': 'harshitjain1371999/Goodreads', 'size': '2770'}