<jupyter_start><jupyter_text>Insight* January month has the highest number of peaks >> Activity is high >> More Sales during Jan * There is high degree of variance in reviews added over time<jupyter_code>rating_series = pd.DataFrame(kindle.review_date)
dforms=[]
for x in rating_series.review_date:
    dforms.append((pd.to_datetime(x)).value)
# now we have dforms which has dates transformed to numeric values
rating2 = rating_series.assign(date_min = dforms)
rating2.reset_index(inplace=True)
#rating2.set_index('date_min')
#rating2.columns=['timestamp_string','review_count','date_min']
bins = np.linspace(min(rating2.date_min),max(rating2.date_min),num=50)
rating2.hist(column='date_min', bins=20,figsize=(10,6),)
rating2.hist(column='date_min', bins=30,figsize=(10,6))
rating2.hist(column='date_min', bins=50,figsize=(10,6))
def NPS_eval (A):
    score =0
    for x in A[:]:
        if (x>4) :
            score+=1
        elif (x<3) :
            score-=1
    return 100*score/len(A)    
NPS_overtime = kindle[['temp','star_rating']]
NPS_overtime.groupby(by='temp').agg(NPS_eval).plot(figsize=(15,10))
NPS_overtime['timeline']= NPS_overtime['temp'].apply(lambda x : (x.month+(12*(x.year-2010))))
NPS_by_month= NPS_overtime.groupby(by='timeline').agg(NPS_eval)
print(NPS_by_month.plot())
plt.ylabel('Net promoter score')
NPS_by_month.sort_values(by='star_rating')<jupyter_output>AxesSubplot(0.125,0.125;0.775x0.755)
{'fraction_non_alphanumeric': 0.15704225352112677, 'fraction_numerical': 0.04225352112676056, 'mean_word_length': 6.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '224998', 'license': 'MIT', 'n_tokens_mistral': 561, 'n_tokens_neox': 529, 'n_words': 90, 'path': 'WHUT-MCM2020国奖/Problem_C/.ipynb_checkpoints/Temporal-checkpoint.ipynb', 'repo_name': '775269512/WHUT_CUMCM20', 'size': '1420'}