from collections import Counter import pandas as pd basecsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/skuid_05lp.csv" lpcsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/skuidlps.csv" ''' Example multivalue dictionary dict = {key1: [value1, value2, value3, value4], key2: [value5, value6, value 7], } So this could be used for each learning path. In other words: learning_paths = {'01:Skuid Ethos' : ["Congratulations", "Create", "Skuid Resources"]} etc etc Ideally, we will add Alexa's "levels" in this dictionary as well. Could we do: learning_paths = {'Level_1': [{'01:Skuid Ethos' : ["Congratulations", "Create", "Skuid Resources"]}, {'02:Composer' : ["Overview", "Get Started with Composer", "Manage Pages"}] {'03:Design System Studio' : ["Get Started with Design Systems", etc etc]}, 'Level_2': [{'10 - Data' : ["Tips to Optimize", "Smarter Conditions"]}, {'11-Components': ["Battle", "Engage"]}, ] } How to create this by automation? ''' def lpLevels(lpcsv): levels = pd.read_csv( lpcsv, index_col=False, ) print(levels.Level.unique()) # Print only unique values from the Level column def mainFunc(basecsv): readData = pd.read_csv( basecsv, index_col=False, ) readData.drop_duplicates(subset='Course Name', keep="first") emailGroups = readData.groupby("Email")["Course Name"].nunique() print(emailGroups) emailGroups = emailGroups.to_csv('/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/outtest.csv') #if readData.loc[readData['Course Name'].isin([ # 'Get Started with Models - Level 1', # 'Configure Model Fields - Level 1', # 'Configure Model Conditions - Level 1', # 'Configure Model Actions - Level 1', # 'Manage Models - Level 1', # 'Intro to UI Only Fields - Level 1'])]: # extractedList = readData.loc[readData['Email'].tolist()] # fourOccs = Counter(extractedList) # finalNames = [] # for name, occurences in fourOccs.items(): # if occurences == 6: # finalNames.append(name) if __name__ == "__main__": #mainFunc(basecsv) lpLevels(lpcsv)