2022-11-22 17:13:39 -05:00
|
|
|
from collections import Counter
|
2022-12-05 15:07:58 -05:00
|
|
|
import pandas as pd
|
2022-11-22 17:13:39 -05:00
|
|
|
|
2022-12-05 15:07:58 -05:00
|
|
|
basecsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/Skuid_MCA125.csv"
|
2022-12-07 14:10:10 -05:00
|
|
|
lpcsv = "/Users/normrasmussen/Documents/Northpass/Scripts/Skuid_LPs/skuidlps.csv"
|
2022-11-28 19:50:30 -05:00
|
|
|
|
2022-12-05 15:07:58 -05:00
|
|
|
"""
|
2022-11-28 19:50:30 -05:00
|
|
|
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:
|
|
|
|
|
|
2022-12-05 15:07:58 -05:00
|
|
|
learning_paths = {'01:Skuid Ethos' : ["Congratulations", "Create", "Skuid Resources"]} etc etc
|
2022-11-28 19:50:30 -05:00
|
|
|
|
|
|
|
|
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"}]
|
2022-12-05 15:07:58 -05:00
|
|
|
{'03:Design System Studio' : ["Get Started with Design Systems", etc etc]},
|
2022-11-28 19:50:30 -05:00
|
|
|
'Level_2': [{'10 - Data' : ["Tips to Optimize", "Smarter Conditions"]},
|
2022-12-05 15:07:58 -05:00
|
|
|
{'11-Components': ["Battle", "Engage"]},
|
|
|
|
|
]
|
2022-11-28 19:50:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
How to create this by automation?
|
2022-12-05 15:07:58 -05:00
|
|
|
"""
|
|
|
|
|
|
2022-11-28 19:50:30 -05:00
|
|
|
|
2022-12-07 14:10:10 -05:00
|
|
|
def lpLevels(basecsv, lpcsv):
|
2022-11-28 19:50:30 -05:00
|
|
|
levels = pd.read_csv(
|
2022-12-05 15:07:58 -05:00
|
|
|
lpcsv,
|
2022-12-07 14:10:10 -05:00
|
|
|
index_col=1,
|
2022-12-05 15:07:58 -05:00
|
|
|
)
|
2022-12-07 14:10:10 -05:00
|
|
|
newDf = levels.groupby("Learning Path")
|
2022-12-09 23:25:44 -05:00
|
|
|
newDf2 = newDf.apply(lambda x: x["Course Name"].unique())
|
|
|
|
|
learningpaths = newDf2.apply(pd.Series)
|
|
|
|
|
learningpaths.rename_axis(index=0)
|
2022-12-07 14:10:10 -05:00
|
|
|
mainFunc(basecsv, learningpaths)
|
2022-12-05 15:07:58 -05:00
|
|
|
# print(levels.Level.unique()) # Print only unique values from the Level column
|
|
|
|
|
|
2022-11-22 17:13:39 -05:00
|
|
|
|
2022-12-07 14:10:10 -05:00
|
|
|
def mainFunc(basecsv, learningpaths):
|
|
|
|
|
# Part 1
|
2022-11-22 17:13:39 -05:00
|
|
|
readData = pd.read_csv(
|
2022-12-05 15:07:58 -05:00
|
|
|
basecsv,
|
|
|
|
|
)
|
2022-12-07 14:10:10 -05:00
|
|
|
group = readData.groupby("Learner Full Name")
|
|
|
|
|
df2 = group.apply(lambda x: x["Course Name"].unique())
|
|
|
|
|
df2 = df2.apply(pd.Series, dtype="string")
|
|
|
|
|
# print(df2)
|
|
|
|
|
# This prints a dataframe with the learner's name as the index column and the courses as adjacent columns
|
|
|
|
|
|
|
|
|
|
# Part 2
|
2022-12-09 23:25:44 -05:00
|
|
|
courses = learningpaths.set_index(0)
|
2022-12-07 14:10:10 -05:00
|
|
|
# print(courses)
|
2022-12-09 23:25:44 -05:00
|
|
|
# lp_dict = learningpaths.to_dict("index")
|
|
|
|
|
# courses = lp_dict.values()
|
2022-12-07 14:10:10 -05:00
|
|
|
# Part 3
|
2022-12-09 23:25:44 -05:00
|
|
|
print(df2.isin(df2))
|
|
|
|
|
# This produces a bunch of T/F in the dataframe. Is the solution to do:
|
|
|
|
|
# for courses in lp_dict, for row(person) in readData
|
|
|
|
|
# if number of True == length/# of values in courses
|
|
|
|
|
# Add to "Finished List"
|
2022-12-07 14:10:10 -05:00
|
|
|
|
|
|
|
|
# df3 = df2.columns
|
|
|
|
|
# print(df3)
|
|
|
|
|
# for name in df3.items():
|
|
|
|
|
# print(f"name: {name}")
|
|
|
|
|
|
2022-11-22 17:13:39 -05:00
|
|
|
|
2022-12-05 15:07:58 -05:00
|
|
|
if __name__ == "__main__":
|
2022-12-07 14:10:10 -05:00
|
|
|
# mainFunc(basecsv)
|
|
|
|
|
lpLevels(basecsv, lpcsv)
|