Input_pyspark_dataframe:
id name collection student.1.price student.2.price student.3.price
111 aaa 1 100 999 232
222 bbb 2 200 888 656
333 ccc 1 300 777 454
444 ddd 1 400 666 787
output_pyspark_dataframe
id name collection price
111 aaa 1 100
222 bbb 2 888
333 ccc 1 300
444 ddd 3 787
we can find the correct price of each id by using value present in the collection column
Question
using pyspark, How i can find the correct price of each id by dynamically framing column name student.{collection}.price
?
please let me know.