Forked from abhijeet-talaulikar/mta-credit-card-stats.py
Created
September 27, 2023 16:02
-
-
Save Sandy4321/bd8a045005bd5644f808d7047ff0ee46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
df_scatter = df_multi.copy() | |
df_scatter['Coverage'] = df_scatter['Channel'].map( | |
campaign_data.groupby('channel')['customer_id'].nunique().to_dict() | |
) | |
df_scatter['Total Clicks'] = df_scatter['Channel'].map( | |
journeys['path'].apply(lambda x: x[-2]).value_counts().to_dict() | |
) | |
df_scatter['Activation Clicks'] = df_scatter['Channel'].map( | |
journeys.loc[ | |
journeys.path.apply(lambda x: x[-1]) == 'Activation', | |
'path' | |
].apply(lambda x: x[-2]).value_counts().to_dict() | |
) | |
df_scatter['Attribution'] = df_scatter['Activations'] / df_scatter['Activations'].sum() | |
df_scatter['Activation Rate'] = df_scatter['Activations'] / df_scatter['Coverage'] | |
df_scatter['Click Activation Rate'] = df_scatter['Activation Clicks'] / df_scatter['Total Clicks'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment