from collections import Counter import pandas as pd basecsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/Skuid_MCA125.csv" lpcsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/skuidlps2.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=None, header=None, ) # print(levels.Level.unique()) # Print only unique values from the Level column def mainFunc(basecsv): readData = pd.read_csv( basecsv, ) # lp01 = readData[readData["Course Name"] == # print(lp01) # people = lp01.groupby(["Email", "Learner Full Name"])["Course Name"].nunique() # print(people) # readData.drop_duplicates(subset="Course Name", keep="first") lvl1 = readData.loc["Course Name"].any() if lvl1.str.contains('Level 1'): emailGroups = readData.groupby(["Email", "Learner Full Name"])["Course Name"].nunique() print(emailGroups) # emailGroups = people.to_csv( # "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/outtest2.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, occurrences in fourOccs.items(): # if occurrences == 6: # finalNames.append(name) if __name__ == "__main__": mainFunc(basecsv) # lpLevels(lpcsv)