Create a round-robin schedule where each department plays with every other department exactly once. No department should play against itself, and duplicate matchups like A vs B and B vs A should be avoided.
Input Data:

fabricofdata.com
Expected Output:
Input DataFrame Script
from pyspark.sql.types import StructType,StructField,StringType
from pyspark.sql.functions import col,row_number
from pyspark.sql.window import Window
data= [("Engineering",),("Marketing",),("Sales",),("HR",),("Finance",),("Product",)]
schema = "DepartmentName string"
df=spark.createDataFrame(data,schema)
df.show()
Try solving the question yourself! If you need help, click below to reveal the solution.