<jupyter_start><jupyter_text>Adjust data type<jupyter_code># Customer Data
df_customer_data['Member Since'] = pd.to_datetime(df_customer_data['Member Since'],format='%d-%m-%Y')
df_customer_data['Last Visit'] = pd.to_datetime(df_customer_data['Last Visit'],format='%d-%m-%Y')
df_customer_data['revisit'] = np.where(df_customer_data['Member Since'] == df_customer_data['Last Visit'],True,False )

#Items Details
df_customer_item_details['Customer'] = pd.to_numeric(df_customer_item_details['Customer'],errors='coerce')
Jav_event = (df_customer_data['Member Since'] == pd.to_datetime('21-11-2021'))
df_customer_data.loc[Jav_event].count()
jav_event_revisit =  df_customer_data.loc[Jav_event].groupby([df_customer_data['Sex'],df_customer_data['revisit']],dropna=False).agg({'count'})
jav_event_revisit.to_excel('../result/2021/2nd term/jav_event_revisit.xlsx')
jav_event_revisit
pgm = (df_customer_data['Member Since'] >= pd.to_datetime('12-4-2021')) & (df_customer_data['Member Since'] <= pd.to_datetime('12-5-2021'))
pgm_event_revisit =  df_customer_data.loc[pgm].groupby([df_customer_data['Sex'],df_customer_data['revisit']],dropna=False).agg({'count'})
pgm_event_revisit.to_excel('../result/2021/2nd term/pgm_event_revisit.xlsx')
pgm_event_revisit
first_ads = (df_customer_data['Member Since'] >= pd.to_datetime('8-6-2021')) & (df_customer_data['Member Since'] <= pd.to_datetime('13-6-2021'))
first_ads_revisit =  df_customer_data.loc[first_ads].groupby([df_customer_data['Sex'],df_customer_data['revisit']],dropna=False).agg({'count'})
first_ads_revisit<jupyter_output><empty_output><jupyter_text>Item Details<jupyter_code>df_customer_item_details
#customer_index_data = df_customer_data.groupby(['Sex']).agg({'count'})
#customer_items_index_data = df_customer_item_details.groupby(['Customer','Items']).agg({'count'})

#customer_items_index_data
merge_customer_items =  pd.merge(df_customer_data,df_customer_item_details,left_on=['Phone'],right_on=['Customer'])
order_by_sex = merge_customer_items.groupby(['Sex','Items']).agg({'count'})
order_by_sex<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1729106628242075, 'fraction_numerical': 0.021613832853025938, 'mean_word_length': 12.794701986754967, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '615710', 'license': 'MIT', 'n_tokens_mistral': 795, 'n_tokens_neox': 769, 'n_words': 65, 'path': 'jupyter/Event.ipynb', 'repo_name': 'fakhrulraharjo/maraville-data', 'size': '2082'}