<jupyter_start><jupyter_text>let's checkout the reviews over time for some different products<jupyter_code>prod_groups = df2.groupby('product')
f = plt.figure(figsize=(12, 8))
ax = plt.gca()
f = df.rating.hist(ax=ax, bins=30)
df.rating.mean()
print df.user.unique().shape[0], 'unique users'
users = df.groupby('user').count()

f = plt.figure(figsize=(12, 8))
ax = plt.gca()
f = users.rating.hist(ax=ax, bins=50)
print 'max number of ratings by a user:', users.rating.max()
print 'for user', users.rating.argmax()<jupyter_output>max number of ratings by a user: 345
for user Chill_Panda<jupyter_text>uhhh...need to remove 'anonymous' reviews. Riiiight now this is done in the data_preprocess.load_data() function<jupyter_code>df_no_anon = df[df['user'] != 'Anonymous']
f =plt.figure(figsize=(12, 8))
ax = plt.gca()
f = df_no_anon.rating.hist(ax=ax, bins=30)
df.rating.mean()
users = df_no_anon.groupby('user').count()

f = plt.figure(figsize=(12, 8))
ax = plt.gca()
f = users.rating.hist(ax=ax, bins=50)
print 'max number of ratings by a user:', users.rating.max()
print 'for user', users.rating.argmax()
users.sort_values(by='rating', ascending=False)
most_ratings = users[users['rating'] > 10]
most_ratings.shape
# users with fewer than 20 ratings
fewer_ratings = users[users['rating'] < 20]
fewer_ratings.shape[0]
f = plt.figure(figsize=(12, 8))
ax = plt.gca()
f = fewer_ratings.rating.hist(ax=ax, bins=20)
fewer_ratings.rating.mean()
fewer_ratings.rating.mode()[0]
df[df['user'] == 'Anonymous'].shape[0]
df.shape[0]
# users with more than 1 rating
more_ratings = users[(users['rating'] > 1)]# & (users['rating'] < 30)]
more_ratings.shape[0]
more_ratings = users[(users['rating'] > 1) & (users['rating'] < 30)]
more_ratings.shape
f = plt.figure(figsize=(12, 8))
ax = plt.gca()
f = more_ratings.rating.hist(ax=ax, bins=200)
df.columns
products = df.groupby('product')
f = products.count()['rating'].hist(bins=100)
products.count()['rating'].mean()
products.count()['rating'].argmax()
prod_rev_cnt = products.count()
fewer_reviews = prod_rev_cnt[prod_rev_cnt.rating < 1000]
f = fewer_reviews.rating.hist(bins=1000)
df.shape[0]
more_reviews = prod_rev_cnt[(prod_rev_cnt.rating > 3)]
more_reviews.shape
prod_rev_cnt.shape<jupyter_output><empty_output><jupyter_text>luckily just found out some of the strain names are messed up...encoded or something<jupyter_code>df2 = dp.load_data(fix_names=False)
prod_rev_cnt = df2.groupby('product').count()
products = prod_rev_cnt.index
prod_by_len = sorted(products, key=lambda x: len(x), reverse=True)
prod_by_len
import scrape_leafly as sl
strains = sl.load_current_strains()
strain_names = np.array([s.split('/')[-1] for s in strains])
mask = strain_names == '0bf3f759-186e-4dad-89d0-e0fc7598ac53'
strains = np.array(strains)
strains[mask] # turns out it's berry white
mask = strain_names == '29aca226-23ba-4726-a4ab-f3bf68f2a3c4'
strains[mask] # turns out it's dynamite
mask = strain_names == 'c42aa00a-595a-4e58-a7af-0f8ab998073a'
strains[mask] # it's kaboom<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1627062706270627, 'fraction_numerical': 0.041584158415841586, 'mean_word_length': 6.48395061728395, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '341402', 'license': 'MIT', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1169, 'n_words': 241, 'path': 'leafly/reviews_EDA.ipynb', 'repo_name': 'nateGeorge/canna-recommend', 'size': '3030'}