I have a spark dataframe (prof_student_df
) that lists student/professor pair for a timestamp. There are 4 professors and 4 students for each timestamp and each prof
As our friend @cronoik mention you need to use Hungarian algorithm, the best code I saw for unbalance assignment problem in python is: https://github.com/mayorx/hungarian-algorithm (also have some example in the repository :) )
you just need to convert your DataFrame into Numpy array and pass to the KM_Matcher then add a column with withColumn function in spark depend on your answer from KM_Matcher.