So basically I have an input data frame as below
which I want to transform into below output
Can anyone please help me as to ho we can implement this using PySpark Dataframes ?
I tried different ways but could not find an optimal way to do the same