Last active
July 11, 2023 23:37
-
-
Save kratika2210/8cf49375e77ec7454d8081875dfaddf3 to your computer and use it in GitHub Desktop.
Add sme levels to questions
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
| import pandas as pd | |
| import numpy as np | |
| import csv | |
| import re | |
| smeLevelDict = { | |
| 'Data Ingestion': ['Experience Platform', 'Data Ingestion and Management', 'Data Ingestion'], | |
| 'General': ['Experience Platform', 'Overview', 'General'], | |
| 'CJA': ['Experience Cloud', 'Data Insights And Audiences', 'CJA'], | |
| 'Schema': ['Experience Platform', 'Data Modeling', 'Schemas'], | |
| 'Query Service': ['Experience Platform', 'Data Science and Queries', 'Query Service'], | |
| 'Dataset': ['Experience Platform', 'Data Ingestion and Management', 'Dataset'], | |
| 'AJO': ['Experience Cloud', 'Customer Journey', 'Journey Optimizer'], | |
| 'Profile': ['Experience Platform', 'Customer Data', 'Real-time Customer Profile'], | |
| 'Identity': ['Experience Platform', 'Customer Data', 'Identity Service'], | |
| 'Source Connector': ['Experience Platform', 'Data Ingestion and Management', 'Sources'], | |
| 'Destination Connectors': ['Experience Platform', 'Activation', 'Destinations'], | |
| 'Segment': ['Experience Platform', 'Customer Data', 'Segmentation Service'], | |
| 'License': ['Experience Platform', 'Administration', 'License Usage'], | |
| 'Field': ['Experience Platform', 'Data Modeling', 'Schemas'], | |
| 'Data Prep': ['Experience Platform', 'Data Ingestion and Management', 'Data Prep'], | |
| 'B2B': ['Experience Platform', 'Customer Data', 'Real-time Customer Data Platform'], | |
| 'JO': ['Experience Cloud', 'Customer Journey', 'Journey Orchestration'], | |
| 'AJO': ['Experience Cloud', 'Customer Journey', 'Journey Optimizer'], | |
| 'DULE': ['Experience Platform', 'Governance, Privacy, and Security', 'Data Governance'], | |
| 'Event': ['Experience Platform', 'Data Collection', 'Event Forwarding'], | |
| 'Hashed Email': ['Experience Platform', 'Customer Data', 'Identity Service'], | |
| 'Destinations': ['Experience Platform', 'Activation', 'Destinations'], | |
| 'UPSERT': ['Experience Platform', 'Data Ingestion and Management', 'Data Ingestion'], | |
| 'Data Distiller': ['Experience Platform', 'Data Science and Queries', 'Query Service'], | |
| 'Flow Service': ['Experience Platform', 'Data Ingestion and Management', 'Dataflows'], | |
| 'Eloqua': ['Experience Platform', 'Data Ingestion and Management', 'Sources'], | |
| 'TTL': ['Experience Platform', 'Customer Data', 'Real-time Customer Profile'], | |
| 'data load': ['Experience Platform', 'Administration', 'License Usage'], | |
| 'RTCDP': ['Experience Platform', 'Customer Data', 'Real-time Customer Data Platform'], | |
| 'Guard Rails': ['Experience Platform', 'Data Ingestion and Management', 'Data Ingestion'], | |
| 'Data security': ['Experience Platform', 'Governance, Privacy, and Security', 'Data Governance'], | |
| 'Edge Network': ['Experience Platform', 'Data Collection', 'Edge Network Server API'], | |
| 'AEP Architecture': ['Experience Platform', 'Overview', 'General'], | |
| 'API': ['Experience Platform', 'Overview', 'General'], | |
| 'WebSDK': ['Experience Platform', 'Data Collection', 'WebSDK'], | |
| 'MobileSDK': ['Experience Platform', 'Data Collection', 'MobileSDK'], | |
| } | |
| smeLevelColumns=['sme_level1', 'sme_level2', 'sme_level3'] | |
| df = pd.read_csv('sme_concepts_qs_in.csv') | |
| # deleting rows with empty 'question' column | |
| df = df.dropna(axis=0, subset=['question']) | |
| # filling 'System' where sme_name is empty | |
| df['sme_name'] = df['sme_name'].fillna('System') | |
| df['sme_levels'] = df['sme_domain'].map(lambda x: [v for k, v in smeLevelDict.items() if bool(re.search(k.lower(), x.lower()))][0]) | |
| df_out = pd.DataFrame(df["sme_levels"].to_list(), columns=smeLevelColumns) | |
| df_out = df_out.join(df) | |
| df_out = df_out.drop(columns=['sme_domain', 'sme_levels']) | |
| # reordering columns | |
| df_out = df_out[['sme_name', 'question', 'sme_level1', 'sme_level2', 'sme_level3']] | |
| df_out.to_csv('sme_concepts_qs_out.csv', index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the review @ken-russell! I have updated the above script and regenerated the csv.